Made use of my own httpr router. Replace GetURLParam with httpr.Param.
This commit is contained in:
parent
0677147b63
commit
b18338e4e1
@ -15,6 +15,8 @@ import (
|
|||||||
"path"
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"git.arav.su/Arav/httpr"
|
||||||
)
|
)
|
||||||
|
|
||||||
type UploadHandlers struct {
|
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) {
|
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)
|
path := path.Join(h.uploadDir, saltedHash)
|
||||||
|
|
||||||
@ -169,7 +171,7 @@ func (h *UploadHandlers) Download(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
name := GetURLParam(r, "name")
|
name := httpr.Param(r, "name")
|
||||||
|
|
||||||
w.Header().Add("Content-Disposition", fmt.Sprintf("attachment; filename=\"%s\"", 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) {
|
func (h *UploadHandlers) Delete(w http.ResponseWriter, r *http.Request) {
|
||||||
var saltedHash string
|
var saltedHash string
|
||||||
if r.Method == "DELETE" {
|
if r.Method == "DELETE" {
|
||||||
saltedHash = GetURLParam(r, "hash")
|
saltedHash = httpr.Param(r, "hash")
|
||||||
} else {
|
} else {
|
||||||
r.ParseForm()
|
r.ParseForm()
|
||||||
saltedHash = r.FormValue("hash")
|
saltedHash = r.FormValue("hash")
|
||||||
|
Loading…
Reference in New Issue
Block a user