aboutsummaryrefslogtreecommitdiff
path: root/backend/api/routes.go
diff options
context:
space:
mode:
authorRyan Mehri <[email protected]>2020-05-11 20:55:49 -0600
committerRyan Mehri <[email protected]>2020-05-11 20:55:49 -0600
commit5f493fbdabad58412fba14b4c9534709d701192e (patch)
tree48f699ba5094f33aacf4649fab4d8b5f590ba7a4 /backend/api/routes.go
parentAdd password check on post hash (diff)
downloadctrl-v-5f493fbdabad58412fba14b4c9534709d701192e.tar.xz
ctrl-v-5f493fbdabad58412fba14b4c9534709d701192e.zip
Rename good
Diffstat (limited to 'backend/api/routes.go')
-rw-r--r--backend/api/routes.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/backend/api/routes.go b/backend/api/routes.go
index 6b9ba43..f8d2e4f 100644
--- a/backend/api/routes.go
+++ b/backend/api/routes.go
@@ -51,26 +51,26 @@ func insertFunc(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "%+v", string(jsonData))
}
-func getHashFunc(w http.ResponseWriter, r *http.Request) {
+func getPasteFunc(w http.ResponseWriter, r *http.Request) {
// no password given for get
- handleGetHash(w, r, "")
+ handleGetPaste(w, r, "")
}
-func getHashWithPasswordFunc(w http.ResponseWriter, r *http.Request) {
+func getPasteWithPasswordFunc(w http.ResponseWriter, r *http.Request) {
// get password from form
_ = r.ParseMultipartForm(0)
- gotPassword := r.FormValue("password")
+ parsedPassword := r.FormValue("password")
- handleGetHash(w, r, gotPassword)
+ handleGetPaste(w, r, parsedPassword)
}
-func handleGetHash(w http.ResponseWriter, r *http.Request, gotPassword string) {
+func handleGetPaste(w http.ResponseWriter, r *http.Request, parsedPassword string) {
// Allow CORS
w.Header().Set("Access-Control-Allow-Origin", "*")
hash := mux.Vars(r)["hash"]
- paste, err := cache.C.Get(hash, gotPassword)
+ paste, err := cache.C.Get(hash, parsedPassword)
// if hash was not found
if err == cache.PasteNotFound {