refactor so var doesn't conflict with import

This commit is contained in:
Amolith 2023-09-26 16:13:45 -04:00
parent 7a1459f876
commit 8692d3ce79
Signed by: Amolith
GPG Key ID: 8AE30347CE28D101
1 changed files with 6 additions and 6 deletions

12
ws.go
View File

@ -36,8 +36,8 @@ func newHandler(w http.ResponseWriter, r *http.Request) {
fmt.Println(err) fmt.Println(err)
} }
} else if action != "delete" { } else if action != "delete" {
url := bmStrict.Sanitize(params.Get("url")) submittedURL := bmStrict.Sanitize(params.Get("submittedURL"))
if url == "" { if submittedURL == "" {
w.WriteHeader(http.StatusBadRequest) w.WriteHeader(http.StatusBadRequest)
_, err := w.Write([]byte("No URL provided")) _, err := w.Write([]byte("No URL provided"))
if err != nil { if err != nil {
@ -67,7 +67,7 @@ func newHandler(w http.ResponseWriter, r *http.Request) {
} }
proj := project{ proj := project{
URL: url, URL: submittedURL,
Name: name, Name: name,
Forge: forge, Forge: forge,
} }
@ -85,8 +85,8 @@ func newHandler(w http.ResponseWriter, r *http.Request) {
fmt.Println(err) fmt.Println(err)
} }
} else if action == "delete" { } else if action == "delete" {
url := params.Get("url") submittedURL := params.Get("submittedURL")
if url == "" { if submittedURL == "" {
w.WriteHeader(http.StatusBadRequest) w.WriteHeader(http.StatusBadRequest)
_, err := w.Write([]byte("No URL provided")) _, err := w.Write([]byte("No URL provided"))
if err != nil { if err != nil {
@ -95,7 +95,7 @@ func newHandler(w http.ResponseWriter, r *http.Request) {
} }
} }
untrack(url) untrack(submittedURL)
http.Redirect(w, r, "/", http.StatusSeeOther) http.Redirect(w, r, "/", http.StatusSeeOther)
} }
} }