diff --git a/xray/utils/resultwriter.go b/xray/utils/resultwriter.go index 5d7702841..f7ab95f42 100644 --- a/xray/utils/resultwriter.go +++ b/xray/utils/resultwriter.go @@ -330,7 +330,7 @@ func getXrayIssueLocationIfValidExists(tech coreutils.Technology, run *sarif.Run return } if strings.TrimSpace(descriptorPath) == "" { - return + descriptorPath = "Package Descriptor" } return sarif.NewLocation().WithPhysicalLocation(sarif.NewPhysicalLocation().WithArtifactLocation(sarif.NewArtifactLocation().WithUri("file://" + descriptorPath))), nil } diff --git a/xray/utils/resultwriter_test.go b/xray/utils/resultwriter_test.go index b6fa06d11..18d053261 100644 --- a/xray/utils/resultwriter_test.go +++ b/xray/utils/resultwriter_test.go @@ -163,7 +163,7 @@ func TestGetXrayIssueLocationIfValidExists(t *testing.T) { name: "No descriptor information", tech: coreutils.Pip, run: CreateRunWithDummyResults().WithInvocations([]*sarif.Invocation{invocation}), - expectedOutput: nil, + expectedOutput: sarif.NewLocation().WithPhysicalLocation(sarif.NewPhysicalLocation().WithArtifactLocation(sarif.NewArtifactLocation().WithUri("file://Package Descriptor"))), }, { name: "One descriptor information",