Skip to content

Commit

Permalink
fix bug (#1682)
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkerou committed Dec 5, 2018
1 parent f463d84 commit 98c7ac7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion routergroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,11 @@ func (group *RouterGroup) createStaticHandler(relativePath string, fs http.FileS
fileServer := http.StripPrefix(absolutePath, http.FileServer(fs))

return func(c *Context) {
file := c.Param("filepath")
if _, nolisting := fs.(*onlyfilesFS); nolisting {
c.Writer.WriteHeader(http.StatusNotFound)
}

file := c.Param("filepath")
// Check if file exists and/or if we have permission to access it
if _, err := fs.Open(file); err != nil {
c.Writer.WriteHeader(http.StatusNotFound)
Expand Down

0 comments on commit 98c7ac7

Please sign in to comment.