[BUG] Escape editor.add_tmpl translation

- Previously translations were escaped, but now translations are
accepted as-is and will be rendered as HTML. Use `TrString` to escape
the translation value.
- Adds integration test.
- Regression of 65248945c9.
- Resolves #3260
This commit is contained in:
Gusted 2024-04-16 12:37:32 +02:00
parent 5a10eec50f
commit a0f47b8de7
No known key found for this signature in database
GPG key ID: FD821B732837125F
2 changed files with 14 additions and 1 deletions

View file

@ -187,6 +187,19 @@ func TestEditFileToNewBranch(t *testing.T) {
})
}
func TestEditorAddTranslation(t *testing.T) {
defer tests.PrepareTestEnv(t)()
session := loginUser(t, "user2")
req := NewRequest(t, "GET", "/user2/repo1/_new/master")
resp := session.MakeRequest(t, req, http.StatusOK)
htmlDoc := NewHTMLParser(t, resp.Body)
placeholder, ok := htmlDoc.Find("input[name='commit_summary']").Attr("placeholder")
assert.True(t, ok)
assert.EqualValues(t, `Add "<filename>"`, placeholder)
}
func TestCommitMail(t *testing.T) {
onGiteaRun(t, func(t *testing.T, _ *url.URL) {
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: 2})