Merge pull request #478 from trheyi/main

[fix] SPA static file server
This commit is contained in:
Max 2023-10-11 09:14:58 -05:00 committed by GitHub
commit 680a8c169c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -38,9 +38,9 @@ func withStaticFileServer(c *gin.Context) {
return return
} }
// PWA app static file server // SPA app static file server
for root, rootLength := range SpaRoots { 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) c.Request.URL.Path = strings.TrimPrefix(c.Request.URL.Path, root)
spaFileServers[root].ServeHTTP(c.Writer, c.Request) spaFileServers[root].ServeHTTP(c.Writer, c.Request)
c.Abort() c.Abort()