mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-21 21:35:28 +02:00
Pull in the latest code from Go's template packages (#11771)
Fixes #10707 Fixes #11507
This commit is contained in:
committed by
GitHub
parent
14d85ec136
commit
9f978d387f
@@ -114,7 +114,6 @@ and2: true
|
||||
or2: true
|
||||
counter2: 3
|
||||
`)
|
||||
|
||||
}
|
||||
|
||||
// Issue 10495
|
||||
@@ -163,7 +162,6 @@ title: "S3P1"
|
||||
}
|
||||
|
||||
func TestGoTemplateBugs(t *testing.T) {
|
||||
|
||||
t.Run("Issue 11112", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@@ -188,11 +186,9 @@ func TestGoTemplateBugs(t *testing.T) {
|
||||
|
||||
b.AssertFileContent("public/index.html", `key = value`)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
func TestSecurityAllowActionJSTmpl(t *testing.T) {
|
||||
|
||||
filesTemplate := `
|
||||
-- config.toml --
|
||||
SECURITYCONFIG
|
||||
@@ -211,20 +207,6 @@ var a = §§{{.Title }}§§;
|
||||
},
|
||||
).BuildE()
|
||||
|
||||
b.Assert(err, qt.Not(qt.IsNil))
|
||||
b.Assert(err.Error(), qt.Contains, "{{.Title}} appears in a JS template literal")
|
||||
|
||||
files = strings.ReplaceAll(filesTemplate, "SECURITYCONFIG", `
|
||||
[security]
|
||||
[security.gotemplates]
|
||||
allowActionJSTmpl = true
|
||||
`)
|
||||
|
||||
b = hugolib.NewIntegrationTestBuilder(
|
||||
hugolib.IntegrationTestConfig{
|
||||
T: t,
|
||||
TxtarString: files,
|
||||
},
|
||||
).Build()
|
||||
|
||||
// This used to fail, but not in >= Hugo 0.121.0.
|
||||
b.Assert(err, qt.IsNil)
|
||||
}
|
||||
|
Reference in New Issue
Block a user