mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-04-05 20:52:50 +08:00
escape file name only when necessary
This commit is contained in:
parent
8e9273db99
commit
34f764007f
@ -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 {
|
||||
|
@ -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())
|
||||
|
Loading…
Reference in New Issue
Block a user