diff options
author | Steve Manuel <nilslice@gmail.com> | 2016-10-13 12:51:21 -0700 |
---|---|---|
committer | Steve Manuel <nilslice@gmail.com> | 2016-10-13 12:51:21 -0700 |
commit | 29d36cd2242637236c9473d110dfaf39b8595bb3 (patch) | |
tree | e1f26bb04fda47f3b0c635cfa2f27e2444419ab4 | |
parent | 76040e1c5cd9b00db383cefeb488af7004c0df02 (diff) |
modify to read multipart form post
-rw-r--r-- | system/admin/handlers.go | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/system/admin/handlers.go b/system/admin/handlers.go index 8b09e3d..b7d6ba0 100644 --- a/system/admin/handlers.go +++ b/system/admin/handlers.go @@ -519,16 +519,21 @@ func deleteHandler(res http.ResponseWriter, req *http.Request) { return } - q := req.URL.Query() - id := q.Get("id") - t := q.Get("type") + err := req.ParseMultipartForm(1024 * 1024 * 4) // maxMemory 4MB + if err != nil { + res.WriteHeader(http.StatusInternalServerError) + return + } + + id := req.FormValue("id") + t := req.FormValue("type") if id == "" || t == "" { res.WriteHeader(http.StatusBadRequest) return } - err := db.DeleteContent(t + ":" + id) + err = db.DeleteContent(t + ":" + id) if err != nil { res.WriteHeader(http.StatusInternalServerError) return |