http: download: use PathEscape instead of QueryEscape (#340)
Former-commit-id: a85344dc54e40ff15cbd6d2a917df7d273a386ce [formerly 323a8d5bac3f44f7bda8e52bcaac16e9dc272fbe] [formerly a0960ca476d5840dbd25a8bbc600d21e7f3624f2 [formerly d97f17facb
]]
Former-commit-id: fc84005e5d05d27829fdabd0b28a681969ed8942 [formerly a11d653f0ee1b370f6248ec4d671f3f200afc898]
Former-commit-id: 5c0d556c93fc37b8cafff8b01b09fa9572cc13ea
pull/726/head
parent
efac18bfef
commit
4d93ec940c
|
@ -71,7 +71,7 @@ func downloadHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (int
|
|||
}
|
||||
name += extension
|
||||
|
||||
w.Header().Set("Content-Disposition", "attachment; filename*=utf-8''"+url.QueryEscape(name))
|
||||
w.Header().Set("Content-Disposition", "attachment; filename*=utf-8''"+url.PathEscape(name))
|
||||
err := ar.Write(w, files)
|
||||
|
||||
return 0, err
|
||||
|
@ -94,7 +94,7 @@ func downloadFileHandler(c *fm.Context, w http.ResponseWriter, r *http.Request)
|
|||
w.Header().Set("Content-Disposition", "inline")
|
||||
} else {
|
||||
// As per RFC6266 section 4.3
|
||||
w.Header().Set("Content-Disposition", "attachment; filename*=utf-8''"+url.QueryEscape(c.File.Name))
|
||||
w.Header().Set("Content-Disposition", "attachment; filename*=utf-8''"+url.PathEscape(c.File.Name))
|
||||
}
|
||||
|
||||
http.ServeContent(w, r, stat.Name(), stat.ModTime(), file)
|
||||
|
|
Loading…
Reference in New Issue