From 0dee98c3dc127256023f1e6195893b3e0e2a84a8 Mon Sep 17 00:00:00 2001 From: oppiliappan Date: Wed, 25 Feb 2026 05:05:26 +0000 Subject: [PATCH] appview/state: normalize handle on login Signed-off-by: oppiliappan --- appview/state/login.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/appview/state/login.go b/appview/state/login.go index a68348e6..929a33f1 100644 --- a/appview/state/login.go +++ b/appview/state/login.go @@ -39,6 +39,9 @@ func (s *State) Login(w http.ResponseWriter, r *http.Request) { returnURL := r.FormValue("return_url") addAccount := r.FormValue("add_account") == "true" + // remove spaces around the handle, handles can't have spaces around them + handle = strings.TrimSpace(handle) + // when users copy their handle from bsky.app, it tends to have these characters around it: // // @nelind.dk: @@ -68,7 +71,11 @@ func (s *State) Login(w http.ResponseWriter, r *http.Request) { redirectURL, err := s.oauth.ClientApp.StartAuthFlow(r.Context(), handle) if err != nil { l.Error("failed to start auth", "err", err) - http.Error(w, err.Error(), http.StatusInternalServerError) + s.pages.Notice( + w, + "login-msg", + fmt.Sprintf("Failed to start auth flow: %v", err), + ) return } -- 2.51.2