From d0867477ff4d6bb5e0a4d0dd5b3d8ca0d41ca11b Mon Sep 17 00:00:00 2001 From: Evan Simkowitz Date: Fri, 26 Apr 2024 12:08:10 -0700 Subject: [PATCH] add path separator for config dir handler (#613) --- wavesrv/cmd/main-server.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wavesrv/cmd/main-server.go b/wavesrv/cmd/main-server.go index 17f27aa9..b4e3228d 100644 --- a/wavesrv/cmd/main-server.go +++ b/wavesrv/cmd/main-server.go @@ -1180,9 +1180,9 @@ func main() { gr.HandleFunc("/api/log-active-state", AuthKeyWrap(HandleLogActiveState)) gr.HandleFunc("/api/read-file", AuthKeyWrapAllowHmac(HandleReadFile)) gr.HandleFunc("/api/write-file", AuthKeyWrap(HandleWriteFile)).Methods("POST") - configPath := filepath.Join(scbase.GetWaveHomeDir(), "config") + configPath := filepath.Join(scbase.GetWaveHomeDir(), "config") + strconv.QuoteRune(filepath.Separator) log.Printf("[wave] config path: %q\n", configPath) - isFileHandler := http.StripPrefix("/config/", http.FileServer(http.Dir(configPath)+"/")) + isFileHandler := http.StripPrefix("/config/", http.FileServer(http.Dir(configPath))) isDirHandler := http.HandlerFunc(configDirHandler) gr.PathPrefix("/config/").Handler(ConfigHandlerCheckIsDir(isDirHandler, isFileHandler))