From 856ad7aac9ad683f2b06946c6b3e5e66971bd157 Mon Sep 17 00:00:00 2001 From: Frederico Santos Date: Mon, 2 Sep 2024 02:06:42 +0100 Subject: [PATCH] Refactor handleAdminDiscordLink function for improved error handling and logging --- api/endpoints.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/api/endpoints.go b/api/endpoints.go index dc647a7..d9fb802 100644 --- a/api/endpoints.go +++ b/api/endpoints.go @@ -669,6 +669,12 @@ func handleProviderLogout(w http.ResponseWriter, r *http.Request) { } func handleAdminDiscordLink(w http.ResponseWriter, r *http.Request) { + err := r.ParseForm() + if err != nil { + httpError(w, r, fmt.Errorf("failed to parse request form: %s", err), http.StatusBadRequest) + return + } + uuid, err := uuidFromRequest(r) if err != nil { httpError(w, r, err, http.StatusUnauthorized)