Skip to content

Commit

Permalink
fix the wrong path configuration in root redirection
Browse files Browse the repository at this point in the history
 before: when path = "" => // -> handler
 after: when path = "" => / -> handler
  • Loading branch information
MasashiSalvador57f committed Apr 15, 2019
1 parent 1ecc2d6 commit 3d70788
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion core/corehttp/redirect.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down

2 comments on commit 3d70788

@GitCop
Copy link

@GitCop GitCop commented on 3d70788 Apr 15, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were the following issues with your Pull Request

We ask for a few features in the commit message for Open Source licensing hygiene and commit message clarity.
git commit --amend can often help you quickly improve the commit message.
Guidelines and a script are available to help in the long run.
Your feedback on GitCop is welcome on this issue.


This message was auto-generated by https://gitcop.com

@GitCop
Copy link

@GitCop GitCop commented on 3d70788 Apr 15, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were the following issues with your Pull Request

We ask for a few features in the commit message for Open Source licensing hygiene and commit message clarity.
git commit --amend can often help you quickly improve the commit message.
Guidelines and a script are available to help in the long run.
Your feedback on GitCop is welcome on this issue.


This message was auto-generated by https://gitcop.com

Please sign in to comment.