feat: allow baseUrl

This commit is contained in:
Bibo Hao
2024-08-06 23:54:40 +08:00
parent f9774698e9
commit 204f2ae0c6
17 changed files with 69 additions and 53 deletions

View File

@@ -5,6 +5,7 @@ import (
"github.com/gin-contrib/static"
"io/fs"
"net/http"
"strings"
)
// Credit: https://github.com/gin-contrib/static/issues/19
@@ -14,7 +15,8 @@ type embedFileSystem struct {
}
func (e embedFileSystem) Exists(prefix string, path string) bool {
_, err := e.Open(path)
relPath := strings.TrimPrefix(path, prefix)
_, err := e.Open(relPath)
return err == nil
}