diff --git a/hugolib/content_map_page.go b/hugolib/content_map_page.go index 9fee7400330..9accd190ec4 100644 --- a/hugolib/content_map_page.go +++ b/hugolib/content_map_page.go @@ -1548,7 +1548,7 @@ func (sa *sitePagesAssembler) assembleResources() error { return false, nil } - relPathOriginal := rs.path.PathRel(ps.m.pathInfo) + relPathOriginal := rs.path.Unmormalized().PathRel(ps.m.pathInfo.Unmormalized()) relPath := rs.path.BaseRel(ps.m.pathInfo) var targetBasePaths []string diff --git a/hugolib/content_map_test.go b/hugolib/content_map_test.go index a41b2aae916..7843ad28589 100644 --- a/hugolib/content_map_test.go +++ b/hugolib/content_map_test.go @@ -280,3 +280,22 @@ P1: {{ $p1.Title }}|{{ $p1.Params.foo }}|{{ $p1.File.Filename }}| filepath.FromSlash("P1: P1 md|md|/content/p1.md|"), ) } + +// Issue #11944 +func TestBundleResourcesGetWithSpacesInFilename(t *testing.T) { + files := ` +-- hugo.toml -- +baseURL = "https://example.com" +disableKinds = ["taxonomy", "term"] +-- content/bundle/index.md -- +-- content/bundle/data with Spaces.txt -- +Data. +-- layouts/index.html -- +{{ $bundle := site.GetPage "bundle" }} +{{ $r := $bundle.Resources.Get "data with Spaces.txt" }} +R: {{ with $r }}{{ .Content }}{{ end }}| +` + b := Test(t, files) + + b.AssertFileContent("public/index.html", "R: Data.") +}