aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2021-10-12 00:04:28 -0700
committerChris Lu <chris.lu@gmail.com>2021-10-12 00:04:28 -0700
commitde1ec050e86ba8ba941de7bc3eaf80ce5b6ee208 (patch)
treea926871b3166c64dc452c07f9343fae0cd1a56dd
parent34f764007fb5de0adb9b666cf42cab2aeea2ef00 (diff)
downloadseaweedfs-de1ec050e86ba8ba941de7bc3eaf80ce5b6ee208.tar.xz
seaweedfs-de1ec050e86ba8ba941de7bc3eaf80ce5b6ee208.zip
fier/s3: save "Content-Disposition" to extended properties
related to https://github.com/chrislusf/seaweedfs/issues/2371
-rw-r--r--weed/server/common.go3
-rw-r--r--weed/server/filer_server_handlers_write_autochunk.go2
2 files changed, 4 insertions, 1 deletions
diff --git a/weed/server/common.go b/weed/server/common.go
index f7a7619f3..16213689d 100644
--- a/weed/server/common.go
+++ b/weed/server/common.go
@@ -256,6 +256,9 @@ func adjustHeaderContentDisposition(w http.ResponseWriter, r *http.Request, file
w.Header().Set("Content-Disposition", responseContentDisposition)
return
}
+ if w.Header().Get("Content-Disposition") != "" {
+ return
+ }
if filename != "" {
filename = url.QueryEscape(filename)
contentDisposition := "inline"
diff --git a/weed/server/filer_server_handlers_write_autochunk.go b/weed/server/filer_server_handlers_write_autochunk.go
index 872d83fca..1c230bad3 100644
--- a/weed/server/filer_server_handlers_write_autochunk.go
+++ b/weed/server/filer_server_handlers_write_autochunk.go
@@ -218,7 +218,7 @@ func (fs *FilerServer) saveMetaData(ctx context.Context, r *http.Request, fileNa
entry.Extended = SaveAmzMetaData(r, entry.Extended, false)
for k, v := range r.Header {
- if len(v) > 0 && (strings.HasPrefix(k, needle.PairNamePrefix) || k == "Cache-Control" || k == "Expires") {
+ if len(v) > 0 && (strings.HasPrefix(k, needle.PairNamePrefix) || k == "Cache-Control" || k == "Expires" || k == "Content-Disposition") {
entry.Extended[k] = []byte(v[0])
}
}