Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

s3: do not persist multi part "Response-Content-Disposition" in request header (#7887)

Chris Lu82dac3df03a8
diff --git a/weed/s3api/s3_metadata_util.go b/weed/s3api/s3_metadata_util.go
index b11ce147a1..71ef623f9c 100644
--- a/weed/s3api/s3_metadata_util.go
+++ b/weed/s3api/s3_metadata_util.go
@@ -47,11 +47,8 @@ func ParseS3Metadata(r *http.Request, existing map[string][]byte, isReplace bool
}
}
- // Handle Response-Content-Disposition (used in presigned URLs)
- // This should be stored as Content-Disposition
- if rcd := r.Header.Get("Response-Content-Disposition"); rcd != "" {
- metadata["Content-Disposition"] = []byte(rcd)
- }
+ // Do NOT persist Response-Content-Disposition: it is a GET-only
+ // presigned-download override and must not be stored as upload metadata.
// Object tagging
if tags := r.Header.Get(s3_constants.AmzObjectTagging); tags != "" {
diff --git a/weed/s3api/s3api_object_handlers_multipart.go b/weed/s3api/s3api_object_handlers_multipart.go
index 7fcebef38f..88e754461b 100644
--- a/weed/s3api/s3api_object_handlers_multipart.go
+++ b/weed/s3api/s3api_object_handlers_multipart.go
@@ -67,16 +67,16 @@ func (s3a *S3ApiServer) NewMultipartUploadHandler(w http.ResponseWriter, r *http
}
// Validate Cache-Control header format if present
- if r.Header.Get("Cache-Control") != "" {
- if _, err := cacheobject.ParseRequestCacheControl(r.Header.Get("Cache-Control")); err != nil {
- s3err.WriteErrorResponse(w, r, s3err.ErrInvalidDigest)
+ if cacheControl := r.Header.Get("Cache-Control"); cacheControl != "" {
+ if _, err := cacheobject.ParseRequestCacheControl(cacheControl); err != nil {
+ s3err.WriteErrorResponse(w, r, s3err.ErrInvalidRequest)
return
}
}
// Validate Expires header format if present
- if r.Header.Get("Expires") != "" {
- if _, err := time.Parse(http.TimeFormat, r.Header.Get("Expires")); err != nil {
+ if expires := r.Header.Get("Expires"); expires != "" {
+ if _, err := time.Parse(http.TimeFormat, expires); err != nil {
s3err.WriteErrorResponse(w, r, s3err.ErrMalformedDate)
return
}