fix: support new static file

This commit is contained in:
710leo 2021-09-02 12:23:20 +08:00
parent bd84c433cd
commit 86b2dcd248
1 changed files with 1 additions and 15 deletions

View File

@ -99,21 +99,7 @@ func configNoRoute(r *gin.Engine) {
arr := strings.Split(c.Request.URL.Path, ".") arr := strings.Split(c.Request.URL.Path, ".")
suffix := arr[len(arr)-1] suffix := arr[len(arr)-1]
switch suffix { switch suffix {
case "png": case "png", "jpeg", "jpg", "svg", "ico", "gif", "css", "js", "html", "htm", "gz", "map":
fallthrough
case "jpeg":
fallthrough
case "jpg":
fallthrough
case "gif":
fallthrough
case "css":
fallthrough
case "js":
fallthrough
case "html":
fallthrough
case "htm":
c.File(path.Join(strings.Split("pub/"+c.Request.URL.Path, "/")...)) c.File(path.Join(strings.Split("pub/"+c.Request.URL.Path, "/")...))
default: default:
c.File(path.Join("pub", "index.html")) c.File(path.Join("pub", "index.html"))