From 955920e8689b2be21847a6704488854971a38dcb Mon Sep 17 00:00:00 2001 From: Max Date: Thu, 7 Sep 2023 22:40:11 +0800 Subject: [PATCH] [fix] the spa router length bug --- service/middleware.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/service/middleware.go b/service/middleware.go index 03f469c42..15d35a7db 100644 --- a/service/middleware.go +++ b/service/middleware.go @@ -39,8 +39,8 @@ func withStaticFileServer(c *gin.Context) { } // PWA app static file server - for root, length := range SpaRoots { - if length >= length && c.Request.URL.Path[0:length] == root { + for root, rootLength := range SpaRoots { + if rootLength >= length && c.Request.URL.Path[0:length] == root { c.Request.URL.Path = strings.TrimPrefix(c.Request.URL.Path, root) spaFileServers[root].ServeHTTP(c.Writer, c.Request) c.Abort()