gin-contrib / static

Static middleware
MIT License
290 stars 41 forks source link

fix: also trim perfix in embedfs #56

Closed bbaa-bbaa closed 2 months ago

bbaa-bbaa commented 3 months ago

https://github.com/gin-contrib/static/blob/722aa5b1b50674374c91c98e37fd426eff79c60b/serve.go#L19-L30

We prune the perfix in http.FileServer, but not in the Exist function. This makes not possible to serve specific subfolder in embed.Fs.

//go:embed public/*
var staticfs embed.FS
func (engine *gin.Engine) {
    engine.Use(static.Serve("/static", static.EmbedFolder(staticfs, "public/static")))
}