Skip to content

Commit

Permalink
reposition override
Browse files Browse the repository at this point in the history
  • Loading branch information
attiasas committed Sep 20, 2023
1 parent d6632a2 commit 79037ef
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions xray/utils/resultwriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,19 +263,19 @@ func addXrayCveIssueToSarifRun(cves []formats.CveRow, issueId, severity, file st
// Non path - should not be used as location
func getXrayIssueLocationIfValidExists(file string, run *sarif.Run, override bool) (location *sarif.Location, err error) {
location = sarif.NewLocation().WithPhysicalLocation(sarif.NewPhysicalLocation().WithArtifactLocation(sarif.NewArtifactLocation().WithUri(file)))
if override {
// Use the content as is
return
}
// Check if full path
exists, err := fileutils.IsFileExists(file, false)
if err != nil || exists {
return
}
// Check if relative path
fullPath := GetFullLocationFileName(file, run.Invocations)
location = sarif.NewLocation().WithPhysicalLocation(sarif.NewPhysicalLocation().WithArtifactLocation(sarif.NewArtifactLocation().WithUri("file://" + fullPath)))
if exists, err = fileutils.IsFileExists(fullPath, false); err != nil || exists {
location = sarif.NewLocation().WithPhysicalLocation(sarif.NewPhysicalLocation().WithArtifactLocation(sarif.NewArtifactLocation().WithUri("file://" + fullPath)))
return
}
if override {
// Use the content as is
return
}
// Not usable content
Expand Down

0 comments on commit 79037ef

Please sign in to comment.