From 0a6c8e5d4970a4042391226bbaf019318028f721 Mon Sep 17 00:00:00 2001 From: "Alexander \"Arav\" Andreev" Date: Fri, 1 Jul 2022 03:43:52 +0400 Subject: [PATCH] Retrieve file's salted hash depending on request's method DELETE or POST. --- internal/handlers/handlers.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/handlers/handlers.go b/internal/handlers/handlers.go index a307cf7..fedc346 100644 --- a/internal/handlers/handlers.go +++ b/internal/handlers/handlers.go @@ -181,7 +181,13 @@ func (h *UploadHandlers) Download(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)