Skip to content

Commit

Permalink
Fix mailto src on Links (#513)
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphholzmann authored and diegomura committed Mar 2, 2019
1 parent 0210f79 commit 9070a77
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils/url.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const PROTOCOL_REGEXP = /^(http|https|ftp|ftps|mailto)\:\/\//i;
const PROTOCOL_REGEXP = /^(http|https|ftp|ftps|mailto)/i;

export const getURL = value => {
if (typeof value === 'string' && !value.match(PROTOCOL_REGEXP)) {
Expand Down
5 changes: 5 additions & 0 deletions tests/url.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,9 @@ describe('getURL', () => {
const url = 'https://react-pdf.org';
expect(getURL(url)).toEqual('https://react-pdf.org');
});

test('should support mailto protocol', () => {
const url = 'mailto:[email protected]';
expect(getURL(url)).toEqual('mailto:[email protected]');
});
});

0 comments on commit 9070a77

Please sign in to comment.