Skip to content

Commit a7629c2

Browse files
authored
Don't allow apostrophe in URLs (#499)
Fixes #488, should end URL if encountered.
1 parent b72c682 commit a7629c2

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

packages/linkifyjs/src/parser.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ export function init({ groups }) {
5050
// but cannot be the very last characters
5151
// Characters that cannot appear in the URL at all should be excluded
5252
const qsNonAccepting = [
53-
tk.APOSTROPHE,
5453
tk.COLON,
5554
tk.COMMA,
5655
tk.DOT,

test/spec/linkifyjs/parser.test.mjs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,9 @@ const tests = [
243243
],
244244
['"https://surrounded.by.quotes/"', [Text, Url, Text], ['"', 'https://surrounded.by.quotes/', '"']],
245245
[
246-
"More weird character in http://facebook.com/#aZ?/:@-._~!$&'()*+,;= that Url",
246+
'More weird character in http://facebook.com/#aZ?/:@-._~!$&()*+,;= that Url',
247247
[Text, Url, Text],
248-
['More weird character in ', "http://facebook.com/#aZ?/:@-._~!$&'()*+,;=", ' that Url'],
248+
['More weird character in ', 'http://facebook.com/#aZ?/:@-._~!$&()*+,;=', ' that Url'],
249249
],
250250
[
251251
'Email with a underscore is [email protected] asd',
@@ -262,6 +262,11 @@ const tests = [
262262
[Text, Url, Text],
263263
["A link in '", 'singlequote.club/wat', "' extra fluff at the end"],
264264
],
265+
[
266+
"I really like http://singlequote.club's website design",
267+
[Text, Url, Text],
268+
['I really like ', 'http://singlequote.club', "'s website design"],
269+
],
265270
[
266271
'Email with mailsomething dot com domain in [email protected]',
267272
[Text, Email],

0 commit comments

Comments
 (0)