Skip to content

Commit b465eb5

Browse files
authored
when stat fails, server should return 404 (#95)
1 parent cb5941d commit b465eb5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

frontend/handler.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,14 @@ func staticMiddleware(root string) gin.HandlerFunc {
3535
return func(c *gin.Context) {
3636
_, err := fs.Stat(embeddedFiles, "dist"+c.Request.URL.Path)
3737
if err != nil {
38-
c.Next()
38+
c.AbortWithStatus(http.StatusNotFound)
3939
return
4040
}
41-
fileServer.ServeHTTP(c.Writer, c.Request)
4241

42+
fileServer.ServeHTTP(c.Writer, c.Request)
4343
}
4444
}
45+
4546
func staticMiddlewareNoRoute(root string) gin.HandlerFunc {
4647
fileServer := http.FileServer(getFileSystem(root))
4748

0 commit comments

Comments
 (0)