[fix] the spa router length bug

This commit is contained in:
Max 2023-09-07 22:40:11 +08:00
parent 68ebf1e6cc
commit 955920e868

View file

@ -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()