feat(s3): preserve Cache-Control header on PutObject, GetObject, HeadObject, and CopyObject#6
Open
feat(s3): preserve Cache-Control header on PutObject, GetObject, HeadObject, and CopyObject#6
Conversation
…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>
Original prompt from Matej
|
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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
Adds
Cache-Controlheader preservation to the S3 service, following the exact same pattern as the existingContent-Encodingsupport.Previously,
Cache-Controlset onPutObjectwas silently dropped —GetObjectandHeadObjectwould not return it. This broke consumers (e.g. seadn'sfallback-processingtest) that rely onCacheControlmetadata surviving a put/get round-trip.Type of change
fix:)feat:)feat!:orfix!:)AWS Compatibility
Real AWS S3 stores and returns the
Cache-Controlheader as a first-class object property (not user metadata). This change mirrors that behavior. TheCopyObjectREPLACE directive logic matches AWS: whenx-amz-metadata-directive: REPLACEis set, the newCache-Controlvalue is used; otherwise the source object's value is preserved.Key review areas
S3Service.java):cacheControlis threaded throughputObject(4 overloads) andstoreObject(3 overloads) via positional params. Verify the null-arg counts are correct in each delegation call.S3Service.java:576):effectiveCacheControlfollows the same conditional aseffectiveContentEncoding— only replaced when directive isREPLACEand a new value is provided.cacheControl, consistent with howcontentEncodingis handled today.Checklist
./mvnw testpasses locally (1609 tests, 0 failures)Link to Devin session: https://app.devin.ai/sessions/06b7e28f3e664783b17ed18060e5c267
Requested by: @Meemaw