Merge pull request #6215 from MasashiSalvador57f/hotfix/root_redirection

fix the wrong path configuration in root redirection
This commit is contained in:
Steven Allen 2019-04-16 11:14:13 -07:00 committed by GitHub
commit ee12ddebfd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,7 +10,11 @@ import (
func RedirectOption(path string, redirect string) ServeOption {
handler := &redirectHandler{redirect}
return func(n *core.IpfsNode, _ net.Listener, mux *http.ServeMux) (*http.ServeMux, error) {
mux.Handle("/"+path+"/", handler)
if len(path) > 0 {
mux.Handle("/"+path+"/", handler)
} else {
mux.Handle("/", handler)
}
return mux, nil
}
}