1
0

Retrieve file's salted hash depending on request's method DELETE or POST.

This commit is contained in:
Alexander Andreev 2022-07-01 03:43:52 +04:00
parent 20702fa97e
commit 0a6c8e5d49
Signed by: Arav
GPG Key ID: 0388CC8FAA51063F

View File

@ -181,7 +181,13 @@ func (h *UploadHandlers) Download(w http.ResponseWriter, r *http.Request) {
} }
func (h *UploadHandlers) Delete(w http.ResponseWriter, r *http.Request) { func (h *UploadHandlers) Delete(w http.ResponseWriter, r *http.Request) {
saltedHash := server.GetURLParam(r, "hash") var saltedHash string
if r.Method == "DELETE" {
saltedHash = server.GetURLParam(r, "hash")
} else {
r.ParseForm()
saltedHash = r.FormValue("hash")
}
path := path.Join(h.conf.Uploads.Directory, saltedHash) path := path.Join(h.conf.Uploads.Directory, saltedHash)