mirror of
https://github.com/beshu-tech/deltaglider.git
synced 2026-04-20 23:41:24 +02:00
fix: Add .delta suffix fallback for delete_object()
- delete_object() now tries with .delta suffix if file not found - Matches the same fallback logic as download/get_object - Fixes deletion of files uploaded as .delta when user provides original name - Add test for delta suffix fallback in deletion This fixes the critical bug where delete_object(Key='file.zip') would fail with NotFoundError when the actual file was stored as 'file.zip.delta'. Now delete_object() works consistently with get_object(): - Try with key as provided - If NotFoundError and no .delta suffix, try with .delta appended - Raises NotFoundError only if both attempts fail 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -311,6 +311,24 @@ class TestBoto3Compatibility:
|
||||
assert response["ResponseMetadata"]["HTTPStatusCode"] == 204
|
||||
assert "test-bucket/to-delete.txt" not in client.service.storage.objects
|
||||
|
||||
def test_delete_object_with_delta_suffix_fallback(self, client):
|
||||
"""Test delete_object with automatic .delta suffix fallback."""
|
||||
# Add object with .delta suffix (as DeltaGlider stores it)
|
||||
client.service.storage.objects["test-bucket/file.zip.delta"] = {
|
||||
"size": 100,
|
||||
"metadata": {
|
||||
"original_name": "file.zip",
|
||||
"compression": "delta",
|
||||
},
|
||||
}
|
||||
|
||||
# Delete using original name (without .delta)
|
||||
response = client.delete_object(Bucket="test-bucket", Key="file.zip")
|
||||
|
||||
assert response["ResponseMetadata"]["HTTPStatusCode"] == 204
|
||||
assert response["DeltaGliderInfo"]["Deleted"] is True
|
||||
assert "test-bucket/file.zip.delta" not in client.service.storage.objects
|
||||
|
||||
def test_delete_objects(self, client):
|
||||
"""Test batch delete."""
|
||||
# Add objects
|
||||
|
||||
Reference in New Issue
Block a user