Skip to content

Commit

Permalink
Fix rebuild when adding a bundle with space in name
Browse files Browse the repository at this point in the history
Fixes #12092
  • Loading branch information
bep committed Feb 21, 2024
1 parent cf7023c commit b8ab5c9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hugolib/pages_capture.go
Expand Up @@ -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())
}
}

Expand Down
23 changes: 23 additions & 0 deletions hugolib/rebuild_test.go
Expand Up @@ -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 --
Expand Down

0 comments on commit b8ab5c9

Please sign in to comment.