mirror of
https://github.com/SecurityBrewery/catalyst.git
synced 2026-10-08 16:05:27 +02:00
Fix routing (#43)
This commit is contained in:
1 parent
3618f9784d
commit
e6baead486
7 files changed
+57
-28
No files matched your search
@@ -5,8 +5,23 @@ import (
|
||||
"net/http"
|
||||
"net/http/httputil"
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func VueStatic(fsys fs.FS) func(w http.ResponseWriter, r *http.Request) {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
handler := http.FileServer(http.FS(fsys))
|
||||
|
||||
if strings.HasPrefix(r.URL.Path, "/static/") {
|
||||
handler = http.StripPrefix("/static/", handler)
|
||||
} else {
|
||||
r.URL.Path = "/"
|
||||
}
|
||||
|
||||
handler.ServeHTTP(w, r)
|
||||
}
|
||||
}
|
||||
|
||||
func Static(fsys fs.FS) func(w http.ResponseWriter, r *http.Request) {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
http.FileServer(http.FS(fsys)).ServeHTTP(w, r)
|
||||
|
||||
Reference in new issue
Block a user