Skip to content

feat(s3): preserve Cache-Control header on PutObject, GetObject, HeadObject, and CopyObject#6

Open
Meemaw wants to merge 1 commit intomainfrom
devin/1775716839-fix-s3-cache-control
Open

feat(s3): preserve Cache-Control header on PutObject, GetObject, HeadObject, and CopyObject#6
Meemaw wants to merge 1 commit intomainfrom
devin/1775716839-fix-s3-cache-control

Conversation

@Meemaw
Copy link
Copy Markdown
Member

@Meemaw Meemaw commented Apr 9, 2026

Summary

Adds Cache-Control header preservation to the S3 service, following the exact same pattern as the existing Content-Encoding support.

Previously, Cache-Control set on PutObject was silently dropped — GetObject and HeadObject would not return it. This broke consumers (e.g. seadn's fallback-processing test) that rely on CacheControl metadata surviving a put/get round-trip.

Type of change

  • Bug fix (fix:)
  • New feature (feat:)
  • Breaking change (feat!: or fix!:)
  • Docs / chore

AWS Compatibility

Real AWS S3 stores and returns the Cache-Control header as a first-class object property (not user metadata). This change mirrors that behavior. The CopyObject REPLACE directive logic matches AWS: when x-amz-metadata-directive: REPLACE is set, the new Cache-Control value is used; otherwise the source object's value is preserved.

Key review areas

  • Overload chain (S3Service.java): cacheControl is threaded through putObject (4 overloads) and storeObject (3 overloads) via positional params. Verify the null-arg counts are correct in each delegation call.
  • CopyObject REPLACE logic (S3Service.java:576): effectiveCacheControl follows the same conditional as effectiveContentEncoding — only replaced when directive is REPLACE and a new value is provided.
  • Not included: Multipart upload path does not set cacheControl, consistent with how contentEncoding is handled today.

Checklist

  • ./mvnw test passes locally (1609 tests, 0 failures)
  • New or updated integration test added (6 tests: put, get, head, copy-preserve, copy-replace, cleanup)
  • Commit messages follow Conventional Commits

Link to Devin session: https://app.devin.ai/sessions/06b7e28f3e664783b17ed18060e5c267
Requested by: @Meemaw


Open with Devin

…Object, and CopyObject

Add cacheControl as a dedicated field on S3Object (following the
contentEncoding pattern) and thread it through putObject, storeObject,
and copyObject in S3Service. Extract Cache-Control from request headers
in S3Controller.putObject, return it in appendObjectHeaders for
GetObject/HeadObject responses, and handle it in handleCopyObject with
REPLACE directive support.

Includes 6 integration tests covering put, get, head, copy-preserve,
copy-replace, and cleanup.

Co-Authored-By: Matej Snuderl <ematej.snuderl@gmail.com>
@devin-ai-integration
Copy link
Copy Markdown

Original prompt from Matej

switch from localstsvk to floci. Minimal vode changes, just change the container image

@devin-ai-integration
Copy link
Copy Markdown

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

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.

1 participant