Skip to content

Commit

Permalink
fix: static fileserver matching rules
Browse files Browse the repository at this point in the history
  • Loading branch information
tangx committed Dec 16, 2021
1 parent f749212 commit 432b8d7
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions rum/fileserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (static *StaticFS) Output(c *gin.Context) (interface{}, error) {

file := c.Param("filepath")
urlPath := c.Request.URL.Path
prefix := strings.TrimRight(urlPath, file)
prefix := strings.TrimSuffix(urlPath, file)

// https://shockerli.net/post/golang-pkg-http-file-server/#支持子目录路径
// 在使用 static 或 staticFS 后, fileserver 的路由工作目录已经切换到文件目录
Expand Down Expand Up @@ -126,7 +126,6 @@ func (r *RouterGroup) StaticFS(path string, fs http.FileSystem) {

r.addOperators(op)
}

}

// Static serves files from the given file system root.
Expand Down

0 comments on commit 432b8d7

Please sign in to comment.