don't accept closing parenthesis as last character of url

This commit is contained in:
Bruno Windels 2021-05-12 22:49:34 +02:00
parent 59a74dbd9f
commit 62bb891e79
2 changed files with 7 additions and 1 deletions

View file

@ -96,6 +96,12 @@ export function tests() {
}
},
"Link doesn't adopt closing parenthesis": assert => {
const link = "(https://matrix.org)";
const out = [{ type: "text", text: "(" }, { type: "link", text: "https://matrix.org" }, { type: "text", text: ")" }];
test(assert, link, out);
},
"Unicode in hostname must not linkify": assert => {
const link = "https://foo.bar\uD83D\uDE03.com";
const out = [{ type: "link", text: "https://foo.bar" },

View file

@ -4,7 +4,7 @@ meaning that any escapes (\) must also
be escaped.
*/
const scheme = "(?:https|http|ftp):\\/\\/";
const noSpaceNorPunctuation = "[^\\s.,?!]";
const noSpaceNorPunctuation = "[^\\s.,?!)]";
const hostCharacter = "[a-zA-Z0-9:.\\[\\]-]";
/*