fix: properly redirect to login page if access to space without user

This commit is contained in:
juancwu 2026-02-23 14:53:48 +00:00
commit 0a2ab751a5

View file

@ -16,7 +16,7 @@ func RequireSpaceAccess(spaceService *service.SpaceService) func(http.HandlerFun
user := ctxkeys.User(r.Context())
if user == nil {
// This should be caught by RequireAuth first, but as a safeguard.
http.Error(w, "Unauthorized", http.StatusUnauthorized)
redirect(w, r, "/auth", http.StatusSeeOther)
return
}