Skip to content

Commit

Permalink
fix(sarif): removes git::http from uri in sarif
Browse files Browse the repository at this point in the history
* fix(sarif): removes git::http from uri in sarif

## Description

## Related issues
- Fixes #5003

## Checklist
- [ ] I've read the [guidelines for contributing](https://aquasecurity.github.io/trivy/latest/community/contribute/pr/) to this repository.
- [ ] I've followed the [conventions](https://aquasecurity.github.io/trivy/latest/community/contribute/pr/#title) in the PR title.
- [ ] I've added tests that prove my fix is effective or that my feature works.
- [ ] I've updated the [documentation](https://github.com/aquasecurity/trivy/blob/main/docs) with the relevant information (if needed).
- [ ] I've added usage information (if the PR introduces new options)
- [ ] I've included a "before" and "after" example to the description (if the PR is a user interface change).
  • Loading branch information
megalucio committed Sep 25, 2023
1 parent 2baad46 commit c7353d0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/report/sarif.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ func ToPathUri(input string, resultClass types.ResultClass) string {
input = ref.Context().RepositoryStr()
}

return strings.ReplaceAll(input, "\\", "/")
return strings.ReplaceAll(strings.ReplaceAll(string(input), "\\", "/"), "git::https:/", "")

Check failure on line 340 in pkg/report/sarif.go

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest)

unnecessary conversion (unconvert)
}

func (sw *SarifWriter) getLocations(name, version, path string, pkgs []ftypes.Package) []location {
Expand Down

0 comments on commit c7353d0

Please sign in to comment.