Skip to content

Commit e5519f5

Browse files
committed
fix: build error
1 parent 4e91512 commit e5519f5

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

serve.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,20 @@ func Serve(urlPrefix string, fs ServeFileSystem) gin.HandlerFunc {
2525
c.Abort()
2626
} else {
2727
path := c.Request.URL.Path
28-
pathHasAdmin := strings.Contains(path, "/admin")
2928
pathHasAPI := strings.Contains(path, "/api")
30-
if !pathHasAdmin || pathHasAPI {
29+
// pathHasAdmin := strings.Contains(path, "/admin")
30+
// pathHasLogin := strings.Contains(path, "/login")
31+
if pathHasAPI {
3132
return
3233
} else {
33-
adminFile, err := fs.Open("index.html")
34+
file, err := fs.Open("index.html")
3435
if err != nil {
3536
logger.LogError("文件不存在: %s", c.Request.URL.Path)
3637
return
3738
}
38-
defer adminFile.Close()
39+
defer file.Close()
3940
// 把文件返回
40-
http.ServeContent(c.Writer, c.Request, "index.html", time.Now(), adminFile)
41+
http.ServeContent(c.Writer, c.Request, "index.html", time.Now(), file)
4142
c.Abort()
4243
}
4344

0 commit comments

Comments
 (0)