From e81fc818f988f3230d1146f15f5e3ad71449a5da Mon Sep 17 00:00:00 2001 From: Rutger Broekhoff Date: Fri, 29 Dec 2023 23:48:03 +0100 Subject: Swap strings.TrimPrefix args --- cmd/git-lfs-server/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/git-lfs-server/main.go b/cmd/git-lfs-server/main.go index 2b75b3d..50675ae 100644 --- a/cmd/git-lfs-server/main.go +++ b/cmd/git-lfs-server/main.go @@ -208,7 +208,7 @@ func (h *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { reqPath = r.URL.Path } log("reqPath: %s", reqPath) - reqPath = strings.TrimPrefix("/", path.Clean(reqPath)) + reqPath = strings.TrimPrefix(path.Clean(reqPath), "/") log("Cleaned reqPath: %s", reqPath) submatches := re.FindStringSubmatch(reqPath) if len(submatches) != 2 { @@ -216,7 +216,7 @@ func (h *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { makeRespError(w, "Not found", http.StatusNotFound) return } - repo := strings.TrimPrefix("/", path.Clean(submatches[1])) + repo := strings.TrimPrefix(path.Clean(submatches[1]), "/") log("Repository: %s", repo) if !slices.ContainsFunc(r.Header.Values("Accept"), isLFSMediaType) { -- cgit v1.2.3