Skip to content

Commit

Permalink
don't accept closing parenthesis as last character of url
Browse files Browse the repository at this point in the history
  • Loading branch information
bwindels committed May 12, 2021
1 parent 59a74db commit 62bb891
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/domain/session/room/timeline/linkify/linkify.js
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
Expand Down
2 changes: 1 addition & 1 deletion src/domain/session/room/timeline/linkify/regex.js
Original file line number Diff line number Diff line change
Expand Up @@ -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:.\\[\\]-]";

/*
Expand Down

0 comments on commit 62bb891

Please sign in to comment.