diff --git a/src/domain/session/room/timeline/linkify/linkify.js b/src/domain/session/room/timeline/linkify/linkify.js index 8cea4b28..333705c1 100644 --- a/src/domain/session/room/timeline/linkify/linkify.js +++ b/src/domain/session/room/timeline/linkify/linkify.js @@ -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" }, diff --git a/src/domain/session/room/timeline/linkify/regex.js b/src/domain/session/room/timeline/linkify/regex.js index 2374ee23..8e75bf91 100644 --- a/src/domain/session/room/timeline/linkify/regex.js +++ b/src/domain/session/room/timeline/linkify/regex.js @@ -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:.\\[\\]-]"; /*