Repository navigation
Description
Split out of #406, where it was suggested as a follow-on. It is not the same
three-line parity fix that #406 was, which is why it gets its own issue.
The gap
S3Object has no fields at all for Cache-Control, Content-Disposition or
Content-Language. Substrate accepts these headers on write and silently discards
them, so GetObject/HeadObject never report them.
Real AWS persists all three as object metadata and returns them on every read. A
consumer serving assets through S3 — cache lifetimes, attachment; filename= download
names, per-language variants — gets no signal here that its metadata is being dropped.
Worse than a wrong value: a test asserting "the download filename survives an upload"
passes while verifying nothing, because the write appears to succeed.
Why it's larger than #406
#406 was one field on an existing struct where the read path already emitted the
header. This needs, per header:
- A new field on
S3Object. - Emission in
objectResponseHeaders. - Capture in
putObject. - COPY-vs-REPLACE handling in
resolveCopyMetadata— with a real design question
aboutx-amz-metadata-directivesemantics for each header. - The multipart carry: recorded on
S3MultipartUploadatCreateMultipartUpload
and copied onto the object atCompleteMultipartUpload, sinceCompleteaccepts
no object-metadata headers.
Four headers × five sites, and (4) is not mechanical. Expires is worth deciding on
in the same pass — it's the fourth header in this family and AWS treats it as
metadata too, though its Expires vs ExpiresString history in the SDKs makes it
the awkward one.
Notes for whoever picks this up
- Read headers with
headerValueFold, not direct map access —AWSRequestis also
built in-process (betty_cfn.goconstructs literals directly), so casing isn't
guaranteed, and RFC 9110 header names are case-insensitive regardless. - Persistence is plain
json.Marshalwith noDisallowUnknownFieldsanywhere, so
adding fields is backward- and forward-compatible with recorded state. - Doing all four (or five) headers in one pass is the point. The two write paths
drifting apart on a single header is exactly what S3: CreateMultipartUpload drops Content-Encoding, so multipart objects lose it #406 was, and a shared resolution
helper covering the whole family is what prevents a repeat.
Acceptance criteria
-
Cache-Control,Content-Disposition,Content-Languagepersist through
PutObjectand are returned byGetObjectandHeadObject. - Same through
CreateMultipartUpload→CompleteMultipartUpload. -
CopyObjecthonorsx-amz-metadata-directivefor each; the COPY-vs-REPLACE
semantics are documented. - A decision recorded on
Expires— implemented or explicitly deferred with a
reason. - Absent headers are not emitted (no empty-string headers on the response).
-
docs/services.mdmultipart subsection updated: the not-modeled list shrinks
accordingly.
Activity
feat(s3): persist Cache-Control, Content-Disposition, Content-Languag…
feat(s3): persist Cache-Control, Content-Disposition, Content-Languag…
feat(s3): persist Cache-Control, Content-Disposition, Content-Languag…
scttfrdmn commentedon Aug 1, 2026
Shipped in v0.83.0 (
go get github.com/scttfrdmn/[email protected]).The release notes and
CHANGELOG.mdrecord the reasoning behind each decision, including where substrate deliberately stops short of what was suggested here.