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.
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user