Skip to content

Commit

Permalink
Fix: *UrlCtr.getUrl resolveReference will omit path of base url, repl…
Browse files Browse the repository at this point in the history
…ace it with
  • Loading branch information
Hexilee committed Oct 8, 2018
1 parent 771dc49 commit 10a9744
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion UrlCtr.go
Expand Up @@ -2,6 +2,7 @@ package gotten

import (
"net/url"
"strings"
)

type (
Expand All @@ -21,7 +22,10 @@ func newUrlCtr(base *url.URL, vars VarsController) *UrlCtr {
func (urlCtr *UrlCtr) getUrl() (result *url.URL, err error) {
result, err = urlCtr.vars.getUrl()
if err == nil {
result = urlCtr.base.ResolveReference(result)
base := *urlCtr.base
base.Path = strings.TrimRight(base.Path, "/") + "/" + strings.TrimLeft(result.Path, "/")
base.RawQuery = result.RawQuery
result = &base
}
return
}

0 comments on commit 10a9744

Please sign in to comment.