Skip to content

Commit d30c8b8

Browse files
fmoessbauerUrist-McGit
authored andcommitted
fix(download): use PURL as key for cache
The hash we used to check if we already resolved a package was too simple, which lead to collisions between source and binary packages. To fix this, we now use the PURL as key, which is by definition unique. Fixes: 2754704 ("feat(download): persistently cache PURL to ...) Signed-off-by: Felix Moessbauer <[email protected]>
1 parent 2754704 commit d30c8b8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/debsbom/download/download.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def __init__(self, cachedir: Path):
4646
@staticmethod
4747
def _package_hash(p: package.SourcePackage | package.BinaryPackage) -> str:
4848
return hashlib.sha256(
49-
json.dumps({"name": p.name, "version": p.version}, sort_keys=True).encode("utf-8")
49+
json.dumps(p.purl().to_string(), sort_keys=True).encode("utf-8")
5050
).hexdigest()
5151

5252
def _entry_path(self, hash: str) -> Path:

0 commit comments

Comments
 (0)