diff options
author | fundon <cfddream@gmail.com> | 2015-01-28 15:18:09 +0800 |
---|---|---|
committer | bep <bjorn.erik.pedersen@gmail.com> | 2015-01-28 09:43:43 +0100 |
commit | ee1045ad42677ca146b2dbed03a5f6481160564c (patch) | |
tree | bc3b46079d4a4197daa5625ddd56c5c9c735a5ac /helpers/url.go | |
parent | 2d8e15a5651408fe40b7365334625c487625a1e0 (diff) |
ignore root path, no need strip traling slash
Diffstat (limited to 'helpers/url.go')
-rw-r--r-- | helpers/url.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/helpers/url.go b/helpers/url.go index e4db6ceb7..380ba29c2 100644 --- a/helpers/url.go +++ b/helpers/url.go @@ -15,11 +15,12 @@ package helpers import ( "fmt" - "github.com/PuerkitoBio/purell" - "github.com/spf13/viper" "net/url" "path" "strings" + + "github.com/PuerkitoBio/purell" + "github.com/spf13/viper" ) type PathBridge struct { @@ -120,8 +121,8 @@ func AddContextRoot(baseUrl, relativePath string) string { newPath := path.Join(url.Path, relativePath) - // path strips traling slash - if strings.HasSuffix(relativePath, "/") { + // path strips traling slash, ignore root path. + if newPath != "/" && strings.HasSuffix(relativePath, "/") { newPath += "/" } return newPath |