From 5517b4ac602235835f7bc9c35cbcc448169f2870 Mon Sep 17 00:00:00 2001 From: Max Date: Wed, 11 Oct 2023 22:13:57 +0800 Subject: [PATCH] [fix] SPA static file server --- service/middleware.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/service/middleware.go b/service/middleware.go index 15d35a7db..b6a6fb7c8 100644 --- a/service/middleware.go +++ b/service/middleware.go @@ -38,9 +38,9 @@ func withStaticFileServer(c *gin.Context) { return } - // PWA app static file server + // SPA app static file server for root, rootLength := range SpaRoots { - if rootLength >= length && c.Request.URL.Path[0:length] == root { + if length >= rootLength && c.Request.URL.Path[0:rootLength] == root { c.Request.URL.Path = strings.TrimPrefix(c.Request.URL.Path, root) spaFileServers[root].ServeHTTP(c.Writer, c.Request) c.Abort()