diff --git a/weed/server/common.go b/weed/server/common.go index 634d5757c..f7a7619f3 100644 --- a/weed/server/common.go +++ b/weed/server/common.go @@ -9,6 +9,7 @@ import ( "io/fs" "mime/multipart" "net/http" + "net/url" "path/filepath" "strconv" "strings" @@ -256,6 +257,7 @@ func adjustHeaderContentDisposition(w http.ResponseWriter, r *http.Request, file return } if filename != "" { + filename = url.QueryEscape(filename) contentDisposition := "inline" if r.FormValue("dl") != "" { if dl, _ := strconv.ParseBool(r.FormValue("dl")); dl { diff --git a/weed/server/filer_server_handlers_read.go b/weed/server/filer_server_handlers_read.go index 9fc9da60f..c24e8780c 100644 --- a/weed/server/filer_server_handlers_read.go +++ b/weed/server/filer_server_handlers_read.go @@ -7,7 +7,6 @@ import ( "io" "mime" "net/http" - "net/url" "path/filepath" "strconv" "strings" @@ -133,7 +132,6 @@ func (fs *FilerServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request) setEtag(w, etag) filename := entry.Name() - filename = url.QueryEscape(filename) adjustHeaderContentDisposition(w, r, filename) totalSize := int64(entry.Size())