mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
Merge pull request #350 from vector-im/bwindels/linkify-parenthesis
Don't accept closing parenthesis as last character of url
This commit is contained in:
commit
41f77f33af
@ -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 => {
|
"Unicode in hostname must not linkify": assert => {
|
||||||
const link = "https://foo.bar\uD83D\uDE03.com";
|
const link = "https://foo.bar\uD83D\uDE03.com";
|
||||||
const out = [{ type: "link", text: "https://foo.bar" },
|
const out = [{ type: "link", text: "https://foo.bar" },
|
||||||
|
@ -4,7 +4,7 @@ meaning that any escapes (\) must also
|
|||||||
be escaped.
|
be escaped.
|
||||||
*/
|
*/
|
||||||
const scheme = "(?:https|http|ftp):\\/\\/";
|
const scheme = "(?:https|http|ftp):\\/\\/";
|
||||||
const noSpaceNorPunctuation = "[^\\s.,?!]";
|
const noSpaceNorPunctuation = "[^\\s.,?!)]";
|
||||||
const hostCharacter = "[a-zA-Z0-9:.\\[\\]-]";
|
const hostCharacter = "[a-zA-Z0-9:.\\[\\]-]";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user