mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
escape file name when there is a quote inside
This commit is contained in:
parent
018f0b73be
commit
c35fe9d631
|
@ -42,6 +42,8 @@ var (
|
|||
store *storage.Store
|
||||
)
|
||||
|
||||
var fileNameEscaper = strings.NewReplacer("\\","\\\\","\"","\\\"")
|
||||
|
||||
func statusHandler(w http.ResponseWriter, r *http.Request) {
|
||||
m := make(map[string]interface{})
|
||||
m["Version"] = VERSION
|
||||
|
@ -147,7 +149,7 @@ func GetHandler(w http.ResponseWriter, r *http.Request) {
|
|||
w.Header().Set("Content-Type", mtype)
|
||||
}
|
||||
if n.NameSize > 0 {
|
||||
w.Header().Set("Content-Disposition", "filename="+string(n.Name))
|
||||
w.Header().Set("Content-Disposition", "filename="+fileNameEscaper.Replace(string(n.Name)))
|
||||
}
|
||||
if ext != ".gz" {
|
||||
if n.IsGzipped() {
|
||||
|
|
Loading…
Reference in a new issue