diff --git a/modules/templates/helper_test.go b/modules/templates/helper_test.go index 27020e6e68..f04724bfe6 100644 --- a/modules/templates/helper_test.go +++ b/modules/templates/helper_test.go @@ -92,9 +92,12 @@ func TestTemplateEscape(t *testing.T) { } t.Run("Golang URL Escape", func(t *testing.T) { - // Golang template considers "href", "*src*", "*uri*", "*url*" (and more) ... attributes as contentTypeURL and does auto-escaping + // HINT: GOLANG-HTML-TEMPLATE-URL-ESCAPING: demo cases (html/template/attr.go): + // Golang template considers "href", "data-href", "*src*", "*uri*", "*url*" (and more) ... attributes as contentTypeURL and does auto-escaping actual := execTmpl(``) assert.Equal(t, ``, actual) + actual = execTmpl(``) + assert.Equal(t, ``, actual) actual = execTmpl(``) assert.Equal(t, ``, actual) }) @@ -102,6 +105,10 @@ func TestTemplateEscape(t *testing.T) { // non-URL content isn't auto-escaped actual := execTmpl(``) assert.Equal(t, ``, actual) + // the attr names like "data-href" and "data-action" are treated as URL (as the "data-" prefix is stripped) + // but "data-xxx-href" and "data-xxx-action" are not, so no escaping. + actual = execTmpl(``) + assert.Equal(t, ``, actual) }) t.Run("QueryBuild", func(t *testing.T) { actual := execTmpl(``) diff --git a/templates/admin/packages/list.tmpl b/templates/admin/packages/list.tmpl index 800f8dac5b..bf71a12d1e 100644 --- a/templates/admin/packages/list.tmpl +++ b/templates/admin/packages/list.tmpl @@ -73,7 +73,7 @@