We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When I use embed.FS and the static resource url prefix is "/demo/", the static resource cannot be found. Here is my code:
import ( "embed" "github.com/gin-gonic/gin" "github.com/gin-contrib/static" ) var embedFS embed.FS engine := gin.Default() staticFS := static.EmbedFolder(embedFS , "public) staticHandlerFunc := static.Serve("/demo/", staticFS ) engine.Use(staticHandlerFunc)
The problem lies in this method( file "embed_folder.go"):
func (e embedFileSystem) Exists(prefix string, path string) bool { _, err := e.Open(path) return err == nil }
This is the code I changed and everything is working fine:
func (e embedFileSystem) Exists(prefix string, path string) bool { if prefix != "" { path = strings.TrimPrefix(path, prefix) } _, err := e.Open(path) return err == nil }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
When I use embed.FS and the static resource url prefix is "/demo/", the static resource cannot be found.
Here is my code:
The problem lies in this method( file "embed_folder.go"):
This is the code I changed and everything is working fine:
The text was updated successfully, but these errors were encountered: