@cryptotaxi247 / kubo / commits / 04c87264b

fix the wrong path configuration in root redirection before: when path = "" => // -> handler after: when path = "" => / -> handler

fix the wrong path configuration in root redirection before: when path = "" => // -> handler after: when path = "" => / -> handler License: MIT Signed-off-by: Masashi Salvador Mitsuzawa <masashisalvador57f@gmail.com>

Masashi Salvador Mitsuzawa committed Apr 15, 2019 at 11:59 UTC 04c87264b17db5ad4bb51ba33b92709211dbd069
1 file changed +5 -1
core/corehttp/redirect.go
+5 -1
@@ -10,7 +10,11 @@ import (
10 func RedirectOption(path string, redirect string) ServeOption {
11 handler := &redirectHandler{redirect}
12 return func(n *core.IpfsNode, _ net.Listener, mux *http.ServeMux) (*http.ServeMux, error) {
13 - mux.Handle("/"+path+"/", handler)
13 + if len(path) > 0 {
14 + mux.Handle("/"+path+"/", handler)
15 + } else {
16 + mux.Handle("/", handler)
17 + }
18 return mux, nil
19 }
20 }