]> git.maquefel.me Git - brevno-suite/hugo/commitdiff
tpl: Fix case issue in templates.Exists
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Mon, 5 May 2025 08:11:28 +0000 (10:11 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Mon, 5 May 2025 09:23:52 +0000 (11:23 +0200)
Fixes #13684

tpl/templates/templates_integration_test.go
tpl/tplimpl/templatestore.go

index d16333ed43ed7c13f30df3538ee97f995a6f3386..baa917eeed1a030852fbc887a47757e6ea76a5ee 100644 (file)
@@ -299,3 +299,19 @@ P2.
        b := hugolib.Test(t, files)
        b.AssertFileContent("public/index.html", "P1: P1.\nP2: foo bar")
 }
+
+func TestTemplateExistsCaseIssue13684(t *testing.T) {
+       t.Parallel()
+
+       files := `
+-- hugo.toml --
+-- layouts/home.html --
+P1: {{ templates.Exists "_partials/MyPartial.html" }}|P1: {{ templates.Exists "_partials/mypartial.html" }}|
+-- layouts/_partials/MyPartial.html --
+MyPartial.
+
+`
+
+       b := hugolib.Test(t, files)
+       b.AssertFileContent("public/index.html", "P1: true|P1: true|")
+}
index 4adf76b293555ea3200e1002cb0037a583a5321c..53880eb330fa622d03ee4e8bf098ed92c4d99426 100644 (file)
@@ -712,6 +712,7 @@ func (s *TemplateStore) RefreshFiles(include func(fi hugofs.FileMetaInfo) bool)
 }
 
 func (s *TemplateStore) HasTemplate(templatePath string) bool {
+       templatePath = strings.ToLower(templatePath)
        templatePath = paths.AddLeadingSlash(templatePath)
        return s.templatesByPath.Contains(templatePath)
 }