diff options
author | Bjørn Erik Pedersen <[email protected]> | 2024-02-21 17:04:32 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2024-02-21 17:49:15 +0100 |
commit | b8ab5c9be6d4bbce609d65ebb51b7acf811e98ff (patch) | |
tree | 56b9a41a0b4eabbb3db593565693959ce8ab43c9 | |
parent | cf7023cb90f70cb2189d562ad8e8e9a66e6eb46e (diff) | |
download | hugo-b8ab5c9be6d4bbce609d65ebb51b7acf811e98ff.tar.gz hugo-b8ab5c9be6d4bbce609d65ebb51b7acf811e98ff.zip |
Fix rebuild when adding a bundle with space in name
Fixes #12092
-rw-r--r-- | hugolib/pages_capture.go | 4 | ||||
-rw-r--r-- | hugolib/rebuild_test.go | 23 |
2 files changed, 25 insertions, 2 deletions
diff --git a/hugolib/pages_capture.go b/hugolib/pages_capture.go index b9d7a0ae1..4328978db 100644 --- a/hugolib/pages_capture.go +++ b/hugolib/pages_capture.go @@ -195,9 +195,9 @@ func (c *pagesCollector) collectDir(dirPath *paths.Path, isDir bool, inFilter fu var dpath string if dirPath != nil { if isDir { - dpath = filepath.FromSlash(dirPath.Path()) + dpath = filepath.FromSlash(dirPath.Unnormalized().Path()) } else { - dpath = filepath.FromSlash(dirPath.Dir()) + dpath = filepath.FromSlash(dirPath.Unnormalized().Dir()) } } diff --git a/hugolib/rebuild_test.go b/hugolib/rebuild_test.go index 54d6888c0..98a8d0949 100644 --- a/hugolib/rebuild_test.go +++ b/hugolib/rebuild_test.go @@ -305,6 +305,29 @@ Pages: {{ range .RegularPages }}{{ .RelPermalink }}|{{ end }}$ b.AssertFileContent("public/index.html", "Pages: /p1/|/p2/|$") } +func TestRebuildAddPageWithSpaceListPagesInHome(t *testing.T) { + files := ` +-- hugo.toml -- +baseURL = "https://example.com" +disableLiveReload = true +-- content/asection/s1.md -- +-- content/p1.md -- +--- +title: "P1" +weight: 1 +--- +-- layouts/_default/single.html -- +Single: {{ .Title }}|{{ .Content }}| +-- layouts/index.html -- +Pages: {{ range .RegularPages }}{{ .RelPermalink }}|{{ end }}$ +` + + b := TestRunning(t, files) + b.AssertFileContent("public/index.html", "Pages: /p1/|$") + b.AddFiles("content/test test/index.md", ``).Build() + b.AssertFileContent("public/index.html", "Pages: /p1/|/test-test/|$") +} + func TestRebuildScopedToOutputFormat(t *testing.T) { files := ` -- hugo.toml -- |