Skip to content

Commit

Permalink
Revert "Don't allow apostrophe in URLs (nfrasser#499)"
Browse files Browse the repository at this point in the history
This reverts commit a7629c2.
Fix: apostrophe is a valid character in a URL
  • Loading branch information
patrickReiis committed Dec 6, 2024
1 parent 86e977c commit 7a2019f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
1 change: 1 addition & 0 deletions packages/linkifyjs/src/parser.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export function init({ groups }) {
// but cannot be the very last characters
// Characters that cannot appear in the URL at all should be excluded
const qsNonAccepting = [
tk.APOSTROPHE,
tk.COLON,
tk.COMMA,
tk.DOT,
Expand Down
9 changes: 2 additions & 7 deletions test/spec/linkifyjs/parser.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,9 @@ const tests = [
],
['"https://surrounded.by.quotes/"', [Text, Url, Text], ['"', 'https://surrounded.by.quotes/', '"']],
[
'More weird character in http://facebook.com/#aZ?/:@-._~!$&()*+,;= that Url',
"More weird character in http://facebook.com/#aZ?/:@-._~!$&'()*+,;= that Url",
[Text, Url, Text],
['More weird character in ', 'http://facebook.com/#aZ?/:@-._~!$&()*+,;=', ' that Url'],
['More weird character in ', "http://facebook.com/#aZ?/:@-._~!$&'()*+,;=", ' that Url'],
],
[
'Email with a underscore is n_frasser@example.xyz asd',
Expand All @@ -262,11 +262,6 @@ const tests = [
[Text, Url, Text],
["A link in '", 'singlequote.club/wat', "' extra fluff at the end"],
],
[
"I really like http://singlequote.club's website design",
[Text, Url, Text],
['I really like ', 'http://singlequote.club', "'s website design"],
],
[
'Email with mailsomething dot com domain in foo@mailsomething.com',
[Text, Email],
Expand Down

0 comments on commit 7a2019f

Please sign in to comment.