summaryrefslogtreecommitdiffstats
path: root/helpers/url.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-01-05 11:07:50 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-01-06 10:29:13 +0100
commitf25d8a9e17fb65fa41dafdcbf0358853d68eaf45 (patch)
treefd8932fdf88b3774b5773866c5f8ceadea2cc15a /helpers/url.go
parent54a89cde69c1fcda7afe0ba0f4e0de86f5f69aa5 (diff)
Fix sub-folder baseURL handling for Page resources
I.e. images etc. Fixes #4228
Diffstat (limited to 'helpers/url.go')
-rw-r--r--helpers/url.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/helpers/url.go b/helpers/url.go
index 8faefeefa..e2501cd1a 100644
--- a/helpers/url.go
+++ b/helpers/url.go
@@ -319,12 +319,11 @@ func AddContextRoot(baseURL, relativePath string) string {
// If canonifyURLs is set, we will globally prepend the absURL with any sub-folder,
// so avoid doing anything here to avoid getting double paths.
func (p *PathSpec) PrependBasePath(rel string) string {
- basePath := p.BaseURL.url.Path
- if !p.canonifyURLs && basePath != "" && basePath != "/" {
+ if p.BasePath != "" {
rel = filepath.ToSlash(rel)
// Need to prepend any path from the baseURL
hadSlash := strings.HasSuffix(rel, "/")
- rel = path.Join(basePath, rel)
+ rel = path.Join(p.BasePath, rel)
if hadSlash {
rel += "/"
}