Merge pull request #456 from trheyi/main

[fix] the spa router length bug
This commit is contained in:
Max 2023-09-07 09:40:43 -05:00 committed by GitHub
commit abd21bd30c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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