diff --git a/internal/http/handlers.go b/internal/http/handlers.go index ffd5893..d774692 100644 --- a/internal/http/handlers.go +++ b/internal/http/handlers.go @@ -15,6 +15,8 @@ import ( "path" "strings" "time" + + "git.arav.su/Arav/httpr" ) type UploadHandlers struct { @@ -159,7 +161,7 @@ func (h *UploadHandlers) Upload(w http.ResponseWriter, r *http.Request) { } func (h *UploadHandlers) Download(w http.ResponseWriter, r *http.Request) { - saltedHash := GetURLParam(r, "hash") + saltedHash := httpr.Param(r, "hash") path := path.Join(h.uploadDir, saltedHash) @@ -169,7 +171,7 @@ func (h *UploadHandlers) Download(w http.ResponseWriter, r *http.Request) { return } - name := GetURLParam(r, "name") + name := httpr.Param(r, "name") w.Header().Add("Content-Disposition", fmt.Sprintf("attachment; filename=\"%s\"", name)) @@ -191,7 +193,7 @@ func (h *UploadHandlers) Download(w http.ResponseWriter, r *http.Request) { func (h *UploadHandlers) Delete(w http.ResponseWriter, r *http.Request) { var saltedHash string if r.Method == "DELETE" { - saltedHash = GetURLParam(r, "hash") + saltedHash = httpr.Param(r, "hash") } else { r.ParseForm() saltedHash = r.FormValue("hash")