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

fixing link can handle more than one @ #6598

Closed
wants to merge 3 commits into from
Closed
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: 1 addition & 0 deletions packages/volto/news/6598.fix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixing links can handle more than one @
15 changes: 15 additions & 0 deletions packages/volto/src/helpers/Url/Url.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
normaliseMail,
normalizeTelephone,
flattenScales,
isMail,
} from './Url';

beforeEach(() => {
Expand Down Expand Up @@ -533,4 +534,18 @@ describe('Url', () => {
});
});
});

describe('isMail', () => {
it('isMale test', () => {
const mailExamples = [
'mailto:[email protected]',
'mailto:[email protected],[email protected]',
'mailto:[email protected][email protected]',
'mailto:[email protected]?subject=Hello&body=World',
];
for (let mail of mailExamples) {
expect(isMail(mail)).toBe(true);
}
});
});
});
2 changes: 1 addition & 1 deletion packages/volto/src/helpers/Url/urlRegex.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import tlds from 'tlds';

export const mailRegex = () =>
/^((mailto:[^<>()/[\].,;:\s@"]+(\.[^<>()[\].,;:\s@"]+)*)|(".+"))@(([^<>()[\].,;:\s@"]+\.)+[^<>()[\].,;:\s@"]{2,})$/i;
/^mailto:([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})(,[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})*(\?[^<>()[\]\s]*)?$/i;

export const telRegex = () =>
/^[tel:]*[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-\s./0-9]*$/g;
Expand Down
Loading