From 55d3c2f3ab64513cc3f910f544828c4cc8681203 Mon Sep 17 00:00:00 2001 From: Eliot Whalan Date: Tue, 28 Jun 2016 08:10:20 +1000 Subject: [PATCH] Improve variable names --- main.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/main.go b/main.go index e03ed9a..baf4653 100644 --- a/main.go +++ b/main.go @@ -139,15 +139,15 @@ func save(raw string, lang string, title string, expiry string) []string { } delKey := uniuri.NewLen(40) - paste := html.EscapeString(raw) + dataEscaped := html.EscapeString(raw) stmt, err := db.Prepare("INSERT INTO pastebin(id, title, hash, data, delkey, expiry) values(?,?,?,?,?,?)") check(err) if title == "" { - _, err = stmt.Exec(id, id, sha, paste, delKey, expiryTime) + _, err = stmt.Exec(id, id, sha, dataEscaped, delKey, expiryTime) check(err) } else { - _, err = stmt.Exec(id, html.EscapeString(title), sha, paste, delKey, expiryTime) + _, err = stmt.Exec(id, html.EscapeString(title), sha, dataEscaped, delKey, expiryTime) check(err) } db.Close() @@ -156,7 +156,7 @@ func save(raw string, lang string, title string, expiry string) []string { func delHandler(w http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) - paste := vars["pasteId"] + id := vars["pasteId"] delkey := vars["delKey"] db, err := sql.Open("mysql", DATABASE) @@ -165,14 +165,14 @@ func delHandler(w http.ResponseWriter, r *http.Request) { stmt, err := db.Prepare("delete from pastebin where delkey=? and id=?") check(err) - res, err := stmt.Exec(html.EscapeString(delkey), html.EscapeString(paste)) + res, err := stmt.Exec(html.EscapeString(delkey), html.EscapeString(id)) check(err) _, err = res.RowsAffected() if err == sql.ErrNoRows { io.WriteString(w, "Error invalid paste") } else { - io.WriteString(w, paste+" deleted") + io.WriteString(w, id+" deleted") } db.Close()