mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-28 22:19:59 +02:00
Fix site.GetPage, never do short lookups for paths with leadig slash
Fixes #12638
This commit is contained in:
@@ -110,11 +110,6 @@ func (c *pageFinder) getPageForRefs(ref ...string) (page.Page, error) {
|
||||
key = refs[1]
|
||||
}
|
||||
|
||||
key = filepath.ToSlash(key)
|
||||
if !strings.HasPrefix(key, "/") {
|
||||
key = "/" + key
|
||||
}
|
||||
|
||||
return c.getPage(nil, key)
|
||||
}
|
||||
|
||||
@@ -211,9 +206,7 @@ func (c *pageFinder) getContentNodeForRef(context page.Page, isReflink, hadExten
|
||||
var doSimpleLookup bool
|
||||
if isReflink || context == nil {
|
||||
slashCount := strings.Count(inRef, "/")
|
||||
if slashCount <= 1 {
|
||||
doSimpleLookup = slashCount == 0 || ref[0] == '/'
|
||||
}
|
||||
doSimpleLookup = slashCount == 0
|
||||
}
|
||||
|
||||
if !doSimpleLookup {
|
||||
|
Reference in New Issue
Block a user