Skip to content

fix: copy metadata upstream#1111

Open
ferhatelmas wants to merge 1 commit into
masterfrom
ferhat/copy-directive
Open

fix: copy metadata upstream#1111
ferhatelmas wants to merge 1 commit into
masterfrom
ferhat/copy-directive

Conversation

@ferhatelmas
Copy link
Copy Markdown
Member

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

fixes #1109

Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
Copilot AI review requested due to automatic review settings May 18, 2026 14:50
@ferhatelmas ferhatelmas requested a review from a team as a code owner May 18, 2026 14:50
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 copyMetadata option down into backend adapters and sets S3 MetadataDirective to REPLACE vs COPY accordingly.
  • 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.

@coveralls
Copy link
Copy Markdown

Coverage Report for CI Build 26041077521

Coverage increased (+0.02%) to 75.095%

Details

  • Coverage increased (+0.02%) from the base build.
  • Patch coverage: 5 of 5 lines across 3 files are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 10312
Covered Lines: 8175
Line Coverage: 79.28%
Relevant Branches: 5970
Covered Branches: 4052
Branch Coverage: 67.87%
Branches in Coverage %: Yes
Coverage Strength: 413.58 hits per line

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

POST /object/copy silently ignores metadata.cacheControl — S3 CopyObjectCommand missing MetadataDirective: 'REPLACE'

3 participants