From d78092de551dea6502920ef26f5d0e2fabb5f5cc Mon Sep 17 00:00:00 2001 From: Mondo Diaz Date: Fri, 30 Jan 2026 09:41:34 -0600 Subject: [PATCH] Fix PyPI proxy to use correct storage.store() method The code was calling storage.store_artifact() which doesn't exist. Changed to use storage.store() which handles content-addressable storage with automatic deduplication. --- backend/app/pypi_proxy.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/backend/app/pypi_proxy.py b/backend/app/pypi_proxy.py index 164995f..6502824 100644 --- a/backend/app/pypi_proxy.py +++ b/backend/app/pypi_proxy.py @@ -451,20 +451,14 @@ async def pypi_download_file( content = response.content content_type = response.headers.get('content-type', 'application/octet-stream') - # Compute hash - sha256 = hashlib.sha256(content).hexdigest() - size = len(content) + # Store in S3 (computes hash and deduplicates automatically) + from io import BytesIO + result = storage.store(BytesIO(content)) + sha256 = result.sha256 + size = result.size logger.info(f"PyPI proxy: downloaded {filename}, {size} bytes, sha256={sha256[:12]}") - # Store in S3 - from io import BytesIO - artifact = storage.store_artifact( - file_obj=BytesIO(content), - filename=filename, - content_type=content_type, - ) - # Check if artifact already exists existing = db.query(Artifact).filter(Artifact.id == sha256).first() if existing: