Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent delimiter apostrophes from being included in URLs #499

Merged
merged 1 commit into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion packages/linkifyjs/src/parser.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ 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: 7 additions & 2 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 [email protected] asd',
Expand All @@ -262,6 +262,11 @@ 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 [email protected]',
[Text, Email],
Expand Down
Loading