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]) } }