From 929aedfd2cf8d2abb794cf692c043218220fa0cd Mon Sep 17 00:00:00 2001 From: Catherine Date: Thu, 18 Sep 2025 20:05:59 +0000 Subject: [PATCH] Use `strings.Trim{Prefix,Suffix}`. NFC --- src/auth.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/auth.go b/src/auth.go index 447698d..5b4f626 100644 --- a/src/auth.go +++ b/src/auth.go @@ -42,8 +42,7 @@ func GetHost(r *http.Request) string { func GetProjectName(r *http.Request) (string, error) { // path must be either `/` or `/foo/` (`/foo` is accepted as an alias) - path, _ := strings.CutPrefix(r.URL.Path, "/") - path, _ = strings.CutSuffix(path, "/") + path := strings.TrimPrefix(strings.TrimSuffix(r.URL.Path, "/"), "/") if strings.HasPrefix(path, ".") { return "", AuthError{http.StatusBadRequest, "directory name %s is reserved"} } else if strings.Contains(path, "/") {