Skip to content

Commit 621cc3c

Browse files
authored
fix: oss-fuzz source links using double Git links (#4036)
1 parent 1abe368 commit 621cc3c

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

gcp/api/integration_tests.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -532,9 +532,9 @@ def test_query_purl(self):
532532
self.assert_results_equal({'vulns': another_expected}, response.json())
533533

534534
expected_deb = [
535-
self._get('CVE-2018-25047'),
536-
self._get('CVE-2023-28447'),
537-
self._get('CVE-2024-35226'),
535+
self._get('DEBIAN-CVE-2018-25047'),
536+
self._get('DEBIAN-CVE-2023-28447'),
537+
self._get('DEBIAN-CVE-2024-35226'),
538538
self._get('DSA-5830-1'),
539539
]
540540

@@ -581,7 +581,6 @@ def test_query_purl(self):
581581
}
582582
}),
583583
timeout=_TIMEOUT)
584-
585584
self.assert_results_equal({'vulns': expected_deb}, response.json())
586585

587586
def test_query_purl_with_version_trailing_zeroes(self):

osv/sources.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,10 @@ def source_path(source_repo, bug):
346346
"""Get the source path for an osv.Bug."""
347347
source_name, source_id = parse_source_id(bug.source_id)
348348
if source_name == 'oss-fuzz' and len(bug.project) > 0:
349-
path = os.path.join(bug.project[0], bug.id() + source_repo.extension)
349+
# Because we populate the Github link for matching, the shortest
350+
# name is the package name.
351+
project = sorted(bug.project, key=len)[0]
352+
path = os.path.join(project, bug.id() + source_repo.extension)
350353
if source_repo.directory_path:
351354
path = os.path.join(source_repo.directory_path, path)
352355

0 commit comments

Comments
 (0)