fix: workaround for routes like /play, /admin which really should have a trailing /
This commit is contained in:
parent
a74717788e
commit
5798132e9b
@ -15,6 +15,14 @@ func FileHandler(w http.ResponseWriter, req *http.Request) {
|
||||
}
|
||||
uri = uri[1:]
|
||||
data, err := Resources.Asset(uri)
|
||||
if err != nil && uri[len(uri)-1] != '/' {
|
||||
// workaround for routes like "/play" which really should be "/play/index.html"
|
||||
uriFolder := uri + "/index.html"
|
||||
data, err = Resources.Asset(uriFolder)
|
||||
if err == nil {
|
||||
uri = uriFolder
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
fmt.Printf("%s: %v\n", uri, err)
|
||||
http.NotFoundHandler().ServeHTTP(w, req)
|
||||
|
@ -1,3 +1,3 @@
|
||||
package Resources
|
||||
|
||||
//go:generate go-bindata -pkg Resources -o dist-generated.go --prefix ../../../client/dist/ ../../../client/dist/ ../../../client/dist/_nuxt/ ../../../client/dist/play ../../../client/dist/admin ../../../client/dist/fonts/dosis ../../../client/dist/fonts/wendy-one
|
||||
//go:generate go-bindata -pkg Resources -o dist-generated.go --prefix ../../../client/dist/ ../../../client/dist/ ../../../client/dist/_nuxt/ ../../../client/dist/play/ ../../../client/dist/admin/ ../../../client/dist/fonts/dosis ../../../client/dist/fonts/wendy-one
|
||||
|
Loading…
Reference in New Issue
Block a user