mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-29 22:29:56 +02:00
Fix recent regression .Resources.Get for resources with spaces in filename
Fixes #11944
This commit is contained in:
@@ -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.")
|
||||
}
|
||||
|
Reference in New Issue
Block a user