From 8e9273db99888fbfb46c18362af7ab6c527814dc Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Mon, 11 Oct 2021 23:29:52 -0700 Subject: [PATCH] s3: use "response-content-disposition" to overwrite default content-disposition fix one part of https://github.com/chrislusf/seaweedfs/issues/2371 see https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html --- weed/server/common.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/weed/server/common.go b/weed/server/common.go index 2054e1a84..634d5757c 100644 --- a/weed/server/common.go +++ b/weed/server/common.go @@ -250,6 +250,11 @@ func handleStaticResources2(r *mux.Router) { } func adjustHeaderContentDisposition(w http.ResponseWriter, r *http.Request, filename string) { + responseContentDisposition := r.FormValue("response-content-disposition") + if responseContentDisposition != "" { + w.Header().Set("Content-Disposition", responseContentDisposition) + return + } if filename != "" { contentDisposition := "inline" if r.FormValue("dl") != "" {