mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-22 16:48:23 +01:00
add path separator for config dir handler (#613)
This commit is contained in:
parent
25b77c7fee
commit
d0867477ff
@ -1180,9 +1180,9 @@ func main() {
|
|||||||
gr.HandleFunc("/api/log-active-state", AuthKeyWrap(HandleLogActiveState))
|
gr.HandleFunc("/api/log-active-state", AuthKeyWrap(HandleLogActiveState))
|
||||||
gr.HandleFunc("/api/read-file", AuthKeyWrapAllowHmac(HandleReadFile))
|
gr.HandleFunc("/api/read-file", AuthKeyWrapAllowHmac(HandleReadFile))
|
||||||
gr.HandleFunc("/api/write-file", AuthKeyWrap(HandleWriteFile)).Methods("POST")
|
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)
|
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)
|
isDirHandler := http.HandlerFunc(configDirHandler)
|
||||||
gr.PathPrefix("/config/").Handler(ConfigHandlerCheckIsDir(isDirHandler, isFileHandler))
|
gr.PathPrefix("/config/").Handler(ConfigHandlerCheckIsDir(isDirHandler, isFileHandler))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user