Skip to content

Commit f051d8a

Browse files
authored
chore: add small fixes (#1081)
Signed-off-by: Ben Selwyn-Smith <[email protected]>
1 parent 979b05b commit f051d8a

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/macaron/repo_finder/repo_finder_deps_dev.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ def find_repo(self, purl: PackageURL) -> tuple[str, RepoFinderInfo]:
5555
tuple[str, RepoFinderOutcome] :
5656
A tuple of the found URL (or an empty string), and the outcome of the Repo Finder.
5757
"""
58+
if not purl.version:
59+
latest_purl, outcome = self.get_latest_version(purl)
60+
if not latest_purl:
61+
return "", outcome
62+
purl = latest_purl
63+
5864
try:
5965
json_data = DepsDevService.get_package_info(str(purl))
6066
except APIAccessError:
@@ -183,7 +189,7 @@ def get_attestation(purl: PackageURL) -> tuple[dict | None, bool]:
183189

184190
# Example of a PURL endpoint for deps.dev with '/' encoded as '%2F':
185191
# https://api.deps.dev/v3alpha/purl/pkg:npm%2F@sigstore%[email protected]
186-
purl_endpoint = DepsDevService().get_purl_endpoint(purl)
192+
purl_endpoint = DepsDevService.get_purl_endpoint(purl)
187193
target_url = urllib.parse.urlunsplit(purl_endpoint)
188194

189195
result = send_get_http(target_url, headers={})

src/macaron/repo_finder/repo_finder_pypi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def find_repo(
6161
if not isinstance(existing_asset, PyPIPackageJsonAsset):
6262
continue
6363

64-
if existing_asset.component_name == purl.name and existing_asset.component_version == purl.version:
64+
if existing_asset.component_name == purl.name:
6565
pypi_asset = existing_asset
6666
from_metadata = True
6767
break

0 commit comments

Comments
 (0)