fix: copy metadata upstream#1111
Open
ferhatelmas wants to merge 1 commit into
Open
Conversation
fixes #1109 Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes metadata propagation during object copy operations so that upstream storage (notably S3) actually applies metadata updates (e.g., Cache-Control) rather than silently preserving the source object’s metadata.
Changes:
- Plumbs a
copyMetadataoption down into backend adapters and sets S3MetadataDirectivetoREPLACEvsCOPYaccordingly. - Fixes file-backend metadata handling during copy to avoid clobbering existing metadata when fields are omitted.
- Extends S3 protocol copy handling/tests to include user metadata (
x-amz-meta-*) and adds acceptance coverage for cache-control overwrite via REST copy.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/storage/backend/adapter.ts | Introduces CopyObjectOptions and extends copyObject signature to accept options. |
| src/storage/object.ts | Forwards { copyMetadata } into backend copyObject calls. |
| src/storage/backend/s3/adapter.ts | Sets S3 MetadataDirective (COPY/REPLACE) and only sends replacement headers when overwriting. |
| src/storage/backend/s3/adapter.test.ts | Adds unit tests asserting correct MetadataDirective and header behavior for copy. |
| src/storage/backend/file.ts | Makes metadata overwrite behavior explicit and preserves existing values when fields are omitted. |
| src/storage/backend/file.test.ts | Adds tests validating copyMetadata behavior for the file backend. |
| src/http/routes/s3/commands/copy-object.ts | Parses x-amz-meta-* headers and forwards Metadata into S3 copy handling. |
| src/test/s3-protocol.test.ts | Adds test coverage ensuring copied objects expose expected user metadata. |
| src/test/object.test.ts | Asserts backend copyObject receives the copyMetadata option and expected metadata overrides. |
| acceptance/specs/s3.test.ts | Extends S3 acceptance coverage for metadata replacement behavior. |
| acceptance/specs/rest-extended.test.ts | Adds acceptance test ensuring REST copy updates served Cache-Control and /object/info output. |
| acceptance/API_COVERAGE.md | Updates documented acceptance coverage to include copy metadata/cache-control overwrite. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Coverage Report for CI Build 26041077521Coverage increased (+0.02%) to 75.095%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
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.
What kind of change does this PR introduce?
Bug fix
What is the current behavior?
Copy didn't propagate metadata directive to upstream.
What is the new behavior?
It's sent correctly.
File backend metadata merge is fixed.
S3 Copy reads user metadata now.
Additional context
fixes #1109