mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 19:11:25 +01:00
fix(terminal): drop escape sequences that markdown character references decode to
Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
2 files changed
+45
No files matched your search
@@ -113,3 +113,14 @@ func TestMarkdownEnabled(t *testing.T) {
|
||||
require.False(t, MarkdownEnabled("raw", true))
|
||||
require.False(t, MarkdownEnabled("auto", false))
|
||||
}
|
||||
|
||||
func TestMarkdownDropsEscapesFromCharacterReferences(t *testing.T) {
|
||||
for _, in := range []string{"a ]0;pwned b", "a [31m b", "a &#27;]52;c;x b", "a ›31m b"} {
|
||||
out := Markdown(in, Display{Width: 80})
|
||||
for _, r := range out {
|
||||
if r == 0x1b || r == 0x07 || (r >= 0x80 && r < 0xa0) {
|
||||
t.Fatalf("Markdown(%q) = %q contains control %U", in, out, r)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user