mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
parent
a2f666b586
commit
e4ad0c5271
2 changed files with 12 additions and 3 deletions
|
@ -254,7 +254,7 @@ func CreateTargetPaths(d TargetPathDescriptor) (tp TargetPaths) {
|
||||||
|
|
||||||
// if page URL is explicitly set in frontmatter,
|
// if page URL is explicitly set in frontmatter,
|
||||||
// preserve its value without sanitization
|
// preserve its value without sanitization
|
||||||
if d.Kind != kinds.KindPage || d.URL == "" {
|
if d.URL == "" {
|
||||||
// Note: MakePathSanitized will lower case the path if
|
// Note: MakePathSanitized will lower case the path if
|
||||||
// disablePathToLower isn't set.
|
// disablePathToLower isn't set.
|
||||||
pb.Sanitize()
|
pb.Sanitize()
|
||||||
|
|
|
@ -235,6 +235,7 @@ slug: custom-recipe-2
|
||||||
}
|
}
|
||||||
|
|
||||||
// Issue 12948.
|
// Issue 12948.
|
||||||
|
// Issue 12954.
|
||||||
func TestPermalinksWithEscapedColons(t *testing.T) {
|
func TestPermalinksWithEscapedColons(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
|
@ -244,9 +245,14 @@ func TestPermalinksWithEscapedColons(t *testing.T) {
|
||||||
|
|
||||||
files := `
|
files := `
|
||||||
-- hugo.toml --
|
-- hugo.toml --
|
||||||
disableKinds = ['home','rss','section','sitemap','taxonomy','term']
|
disableKinds = ['home','rss','sitemap','taxonomy','term']
|
||||||
[permalinks.page]
|
[permalinks.page]
|
||||||
s2 = "/c\\:d/:slug/"
|
s2 = "/c\\:d/:slug/"
|
||||||
|
-- content/s1/_index.md --
|
||||||
|
---
|
||||||
|
title: s1
|
||||||
|
url: "/a\\:b/:slug/"
|
||||||
|
---
|
||||||
-- content/s1/p1.md --
|
-- content/s1/p1.md --
|
||||||
---
|
---
|
||||||
title: p1
|
title: p1
|
||||||
|
@ -258,13 +264,16 @@ title: p2
|
||||||
---
|
---
|
||||||
-- layouts/_default/single.html --
|
-- layouts/_default/single.html --
|
||||||
{{ .Title }}
|
{{ .Title }}
|
||||||
|
-- layouts/_default/list.html --
|
||||||
|
{{ .Title }}
|
||||||
`
|
`
|
||||||
|
|
||||||
b := hugolib.Test(t, files)
|
b := hugolib.Test(t, files)
|
||||||
|
|
||||||
b.AssertFileExists("public/a:b/p1/index.html", true)
|
b.AssertFileExists("public/a:b/p1/index.html", true)
|
||||||
|
b.AssertFileExists("public/a:b/s1/index.html", true)
|
||||||
|
|
||||||
// The above URL comes from the URL front matter field where everything is allowed.
|
// The above URLs come from the URL front matter field where everything is allowed.
|
||||||
// We strip colons from paths constructed by Hugo (they are not supported on Windows).
|
// We strip colons from paths constructed by Hugo (they are not supported on Windows).
|
||||||
b.AssertFileExists("public/cd/p2/index.html", true)
|
b.AssertFileExists("public/cd/p2/index.html", true)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue