From 2d783a5ba74436272ac3b7a23707e5ad32b0170e Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sun, 8 Mar 2026 21:20:26 -0700 Subject: [PATCH] fix: add ErrUserNotFound and ErrPolicyNotFound to groupErrorToHTTPStatus Map these sentinel errors to 404 so AddGroupMember and AttachGroupPolicy return proper HTTP status codes. --- weed/admin/handlers/group_handlers.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/weed/admin/handlers/group_handlers.go b/weed/admin/handlers/group_handlers.go index d6dccd613..cd2aa38fb 100644 --- a/weed/admin/handlers/group_handlers.go +++ b/weed/admin/handlers/group_handlers.go @@ -27,6 +27,12 @@ func groupErrorToHTTPStatus(err error) int { if errors.Is(err, credential.ErrPolicyNotAttached) { return http.StatusBadRequest } + if errors.Is(err, credential.ErrUserNotFound) { + return http.StatusNotFound + } + if errors.Is(err, credential.ErrPolicyNotFound) { + return http.StatusNotFound + } return http.StatusInternalServerError }