Do not render truncated links in markdown (#32980) (#32983)

Backport #32980 by wxiaoguang

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Giteabot 2024-12-26 01:12:18 +08:00 committed by GitHub
parent ad1b76540e
commit a0b65ed17f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 40 additions and 17 deletions

View file

@ -206,6 +206,16 @@ func TestRender_links(t *testing.T) {
test(
"ftps://gitea.com",
`<p>ftps://gitea.com</p>`)
t.Run("LinkSplit", func(t *testing.T) {
input, _ := util.SplitStringAtByteN("http://10.1.2.3", 12)
assert.Equal(t, "http://10…", input)
test(input, "<p>http://10…</p>")
input, _ = util.SplitStringAtByteN("http://10.1.2.3", 13)
assert.Equal(t, "http://10.…", input)
test(input, "<p>http://10.…</p>")
})
}
func TestRender_email(t *testing.T) {