Repository navigation
Conversation
UploadPartCopy accepted x-amz-copy-source-if-* and copied the source anyway. Reject a failed precondition before reserving progress, and forward the headers to the S3 backend. Fixes supabase#1493
Coverage Report for CI Build 37885456270Coverage decreased (-0.07%) to 84.873%Details
Uncovered Changes
Coverage Regressions17 previously-covered lines in 1 file lost coverage.
Coverage Stats💛 - Coveralls |
This branch has not been deployed
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.
Summary
Fixes #1493.
UploadPartCopyacceptedx-amz-copy-source-if-match,x-amz-copy-source-if-none-match,x-amz-copy-source-if-modified-since, andx-amz-copy-source-if-unmodified-since, then copied the source anyway. The handler dropped the headers, so the file backend wrote the part and the S3 backend never sent them toUploadPartCopy. A failed precondition also reserved multipart progress because that reservation happened before the copy.This rejects a failed precondition before reserving progress, and forwards the headers on the S3 backend.
CopyObjectalready enforced the same headers (#1406); this is theUploadPartCopypath.Test plan
src/storage/backend/file.test.ts— mismatchedif-matchreturns 412 and does not write the part; a matching ETag copies the bytessrc/storage/backend/s3/adapter.test.ts— preconditions are set onUploadPartCopyCommandsrc/storage/protocols/s3/s3-handler.test.ts— a failedif-matchreturns 412 before the progress transactionnpm run lintnpm run buildnpm run test:integration) require Docker and Postgres and were not run