mirror of
https://github.com/hibiken/asynqmon.git
synced 2025-01-19 11:15:53 +08:00
Add additional filepath.ToSlash()
`filepath.Join()` also converts slashes to local filesystem separators. It doesn't work properly for embed.FS
This commit is contained in:
parent
564e41eaff
commit
0e61e22b98
@ -45,7 +45,7 @@ func (h *uiAssetsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (h *uiAssetsHandler) indexFilePath() string {
|
func (h *uiAssetsHandler) indexFilePath() string {
|
||||||
return filepath.Join(h.staticDirPath, h.indexFileName)
|
return filepath.ToSlash(filepath.Join(h.staticDirPath, h.indexFileName))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *uiAssetsHandler) renderIndexFile(w http.ResponseWriter) error {
|
func (h *uiAssetsHandler) renderIndexFile(w http.ResponseWriter) error {
|
||||||
@ -81,7 +81,7 @@ func (h *uiAssetsHandler) serveFile(w http.ResponseWriter, path string) (code in
|
|||||||
}
|
}
|
||||||
return http.StatusOK, nil
|
return http.StatusOK, nil
|
||||||
}
|
}
|
||||||
path = filepath.Join(h.staticDirPath, path)
|
path = filepath.ToSlash(filepath.Join(h.staticDirPath, path))
|
||||||
bytes, err := h.contents.ReadFile(path)
|
bytes, err := h.contents.ReadFile(path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// If path is error (e.g. file not exist, path is a directory), serve index file.
|
// If path is error (e.g. file not exist, path is a directory), serve index file.
|
||||||
|
Loading…
Reference in New Issue
Block a user