From fe3e8c4d02c3ab9528a10b93c3f401f938895a30 Mon Sep 17 00:00:00 2001
From: Rutger Broekhoff
Date: Fri, 29 Dec 2023 23:25:25 +0100
Subject: Prefer PATH_INFO over request URL

---
 cmd/git-lfs-server/main.go | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/cmd/git-lfs-server/main.go b/cmd/git-lfs-server/main.go
index 6688f68..f59269e 100644
--- a/cmd/git-lfs-server/main.go
+++ b/cmd/git-lfs-server/main.go
@@ -203,7 +203,11 @@ func isLFSMediaType(t string) bool {
 }
 
 func (h *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
-	submatches := re.FindStringSubmatch(r.URL.Path)
+	reqPath := os.Getenv("PATH_INFO")
+	if reqPath == "" {
+		reqPath = r.URL.Path
+	}
+	submatches := re.FindStringSubmatch(reqPath)
 	if len(submatches) != 1 {
 		log("Got URL: %s", r.URL.Path)
 		makeRespError(w, "Not found", http.StatusNotFound)
-- 
cgit v1.2.3