fix: Handle regular S3 objects without DeltaGlider metadata

- get_object() now transparently downloads regular S3 objects
- Falls back to direct download when file_sha256 metadata is missing
- Enables DeltaGlider to work with existing S3 buckets
- Add test for downloading regular S3 files

Fixes issue where get_object() would fail with NotFoundError when
trying to download objects uploaded outside of DeltaGlider.

This allows users to:
- Browse existing S3 buckets with non-DeltaGlider objects
- Download any S3 object regardless of upload method
- Use DeltaGlider as a drop-in S3 client replacement

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Simone Scarduzio
2025-10-06 14:44:25 +02:00
parent 34c871b0d7
commit 9c1659a1f1
3 changed files with 61 additions and 10 deletions

View File

@@ -258,6 +258,26 @@ class TestBoto3Compatibility:
content = response["Body"].read()
assert content == b"Test Content"
def test_get_object_regular_s3_file(self, client):
"""Test get_object with regular S3 files (not uploaded via DeltaGlider)."""
content = b"Regular S3 File Content"
# Add as a regular S3 object WITHOUT DeltaGlider metadata
client.service.storage.objects["test-bucket/regular-file.pdf"] = {
"data": content,
"size": len(content),
"metadata": {}, # No DeltaGlider metadata
}
# Should successfully download the regular S3 object
response = client.get_object(Bucket="test-bucket", Key="regular-file.pdf")
assert "Body" in response
downloaded_content = response["Body"].read()
assert downloaded_content == content
assert response["ContentLength"] == len(content)
def test_list_objects(self, client):
"""Test list_objects with various options."""
# List all objects (default: FetchMetadata=False)