Skip to content

Commit

Permalink
adjust for relative uri path
Browse files Browse the repository at this point in the history
  • Loading branch information
o-andrieiev committed Dec 12, 2024
1 parent 7ca9cff commit b0fd434
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tests/test_code_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def finalize(self) -> str:
],
"originalUriBaseIds": {
"ROOTPATH": {
"uri": "my_path"
"uri": "file:///my_path"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions universum/modules/code_report_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ def _process_one_sarif_issue(self, issue, root_uri_base_paths, who) -> None:
uri = artifact_data.get('uri')
if not uri:
raise ValueError("Unexpected lack of uri tag")
path = urllib.parse.unquote(urllib.parse.urlparse(uri).path)
if artifact_data.get('uriBaseId'):
# means path is relative, need to make absolute
uri_base_id = artifact_data.get('uriBaseId', '')
root_base_path = root_uri_base_paths.get(uri_base_id, '')
if uri_base_id and not root_base_path:
raise ValueError(f"Unexpected lack of 'originalUriBaseIds' value for {uri_base_id}")
path = str(Path(root_base_path) / path)
uri = str(Path(root_base_path) / uri)
path = urllib.parse.unquote(urllib.parse.urlparse(uri).path)
region_data = location_data.get('region')
if not region_data:
continue # TODO: cover this case as comment to the file as a whole
Expand Down

0 comments on commit b0fd434

Please sign in to comment.