A micro-optimisation. We don't need a name parameter if there is no such file anyway.
This commit is contained in:
parent
6189ddd48d
commit
b49f863abf
@ -212,7 +212,6 @@ func (h *UploadHandlers) Upload(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
func (h *UploadHandlers) Download(w http.ResponseWriter, r *http.Request) {
|
||||
saltedHash := server.GetURLParam(r, "hash")
|
||||
name := server.GetURLParam(r, "name")
|
||||
|
||||
path := path.Join(h.conf.Uploads.Directory, saltedHash)
|
||||
|
||||
@ -222,6 +221,8 @@ func (h *UploadHandlers) Download(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
name := server.GetURLParam(r, "name")
|
||||
|
||||
w.Header().Add("Content-Disposition", fmt.Sprintf("attachment; filename=\"%s\"", name))
|
||||
|
||||
fd, err := os.Open(path)
|
||||
|
Loading…
Reference in New Issue
Block a user