diff --git a/src/macaron/repo_finder/repo_finder_deps_dev.py b/src/macaron/repo_finder/repo_finder_deps_dev.py index 3375151d0..9d723c2d9 100644 --- a/src/macaron/repo_finder/repo_finder_deps_dev.py +++ b/src/macaron/repo_finder/repo_finder_deps_dev.py @@ -55,6 +55,12 @@ def find_repo(self, purl: PackageURL) -> tuple[str, RepoFinderInfo]: tuple[str, RepoFinderOutcome] : A tuple of the found URL (or an empty string), and the outcome of the Repo Finder. """ + if not purl.version: + latest_purl, outcome = self.get_latest_version(purl) + if not latest_purl: + return "", outcome + purl = latest_purl + try: json_data = DepsDevService.get_package_info(str(purl)) except APIAccessError: @@ -183,7 +189,7 @@ def get_attestation(purl: PackageURL) -> tuple[dict | None, bool]: # Example of a PURL endpoint for deps.dev with '/' encoded as '%2F': # https://api.deps.dev/v3alpha/purl/pkg:npm%2F@sigstore%2Fmock@0.7.5 - purl_endpoint = DepsDevService().get_purl_endpoint(purl) + purl_endpoint = DepsDevService.get_purl_endpoint(purl) target_url = urllib.parse.urlunsplit(purl_endpoint) result = send_get_http(target_url, headers={}) diff --git a/src/macaron/repo_finder/repo_finder_pypi.py b/src/macaron/repo_finder/repo_finder_pypi.py index 7525c3779..873bd2a20 100644 --- a/src/macaron/repo_finder/repo_finder_pypi.py +++ b/src/macaron/repo_finder/repo_finder_pypi.py @@ -61,7 +61,7 @@ def find_repo( if not isinstance(existing_asset, PyPIPackageJsonAsset): continue - if existing_asset.component_name == purl.name and existing_asset.component_version == purl.version: + if existing_asset.component_name == purl.name: pypi_asset = existing_asset from_metadata = True break