fix(s3): GetObject/HeadObject return 404/405 for delete markers (#318)#319
Merged
Conversation
Follow-up to #316. getObject already 404'd a delete-marker current version, but two gaps remained, both found via Fatou.jl integration tests: - GET naming the delete-marker version returned 404 NoSuchKey; AWS returns 405 MethodNotAllowed. Neither path emitted the x-amz-delete-marker header. - headObject had no IsDeleteMarker check at all (and ignored versionId), so HEAD on a deleted key returned 200 with marker metadata. New s3DeleteMarkerResponse helper centralizes the AWS-accurate behaviour: 404 NoSuchKey for a delete-marker current version, 405 MethodNotAllowed when a version is named, both with x-amz-delete-marker: true (+ Allow on the 405). headObject is now version-aware and applies the same check. Regression test TestS3_GetHeadObject_DeleteMarker covers all three paths. make lint clean; full S3 suite green. Closes #318
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #316 (ListObjectsV2 delete-marker fix). Found via Fatou.jl integration tests.
Problem
getObjectalready returned 404 for a delete-marker current version, but two gaps remained, andheadObjecthad no delete-marker handling at all:GETnaming the delete-marker version returned404 NoSuchKey; per the S3 API it should be405 MethodNotAllowed.x-amz-delete-marker: true, so SDKs couldn't distinguish a deleted object from a never-existed key.HeadObjecthad noIsDeleteMarkercheck (and ignoredversionId) —HEADon a deleted key returned200with marker metadata.Fix
New
s3DeleteMarkerResponsehelper centralizes AWS-accurate behaviour:404 NoSuchKey+x-amz-delete-marker: true405 MethodNotAllowed+x-amz-delete-marker: true+AllowgetObjectuses it;headObjectis now version-aware and applies the same check.Verification
New
TestS3_GetHeadObject_DeleteMarkercovers all three paths (plain GET 404+header, HEAD 404, versioned GET 405).make lintclean; full S3 suite green. AWS semantics verified against the S3 GetObject API reference.Closes #318