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