Skip to content

Commit c4bdf85

Browse files
authored
Revert "Don't allow apostrophe in URLs (#499)" (#504)
This reverts commit a7629c2. Fix: apostrophe is a valid character in a URL
1 parent f1f9df1 commit c4bdf85

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

packages/linkifyjs/src/parser.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ 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,
5354
tk.COLON,
5455
tk.COMMA,
5556
tk.DOT,

test/spec/linkifyjs/parser.test.mjs

Lines changed: 2 additions & 7 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,11 +262,6 @@ 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-
],
270265
[
271266
'Email with mailsomething dot com domain in [email protected]',
272267
[Text, Email],

0 commit comments

Comments
 (0)