mirror of
https://github.com/gin-gonic/gin.git
synced 2026-07-10 21:06:00 +08:00
Merge 312cd7c9bddf3280c4aac6b438221289e34a8182 into fad706f1216e6d12bdd51d28d5a40ec27e6c6453
This commit is contained in:
commit
76a954ff45
@ -221,19 +221,6 @@ func (group *RouterGroup) createStaticHandler(relativePath string, fs http.FileS
|
|||||||
if _, noListing := fs.(*OnlyFilesFS); noListing {
|
if _, noListing := fs.(*OnlyFilesFS); noListing {
|
||||||
c.Writer.WriteHeader(http.StatusNotFound)
|
c.Writer.WriteHeader(http.StatusNotFound)
|
||||||
}
|
}
|
||||||
|
|
||||||
file := c.Param("filepath")
|
|
||||||
// Check if file exists and/or if we have permission to access it
|
|
||||||
f, err := fs.Open(file)
|
|
||||||
if err != nil {
|
|
||||||
c.Writer.WriteHeader(http.StatusNotFound)
|
|
||||||
c.handlers = group.engine.noRoute
|
|
||||||
// Reset index
|
|
||||||
c.index = -1
|
|
||||||
return
|
|
||||||
}
|
|
||||||
f.Close()
|
|
||||||
|
|
||||||
fileServer.ServeHTTP(c.Writer, c.Request)
|
fileServer.ServeHTTP(c.Writer, c.Request)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user