mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-16 17:52:29 +02:00
fix(v2): treat mailto and tel links properly (#2579)
This commit is contained in:
parent
d531735b3a
commit
399fcbd7eb
2 changed files with 9 additions and 1 deletions
|
@ -27,4 +27,12 @@ describe('isInternalUrl', () => {
|
|||
test('should be false for whatever protocol links', () => {
|
||||
expect(isInternalUrl('//foo.com')).toBeFalsy();
|
||||
});
|
||||
|
||||
test('should be false for telephone links', () => {
|
||||
expect(isInternalUrl('tel:+1234567890')).toBeFalsy();
|
||||
});
|
||||
|
||||
test('should be false for mailto links', () => {
|
||||
expect(isInternalUrl('mailto:someone@example.com')).toBeFalsy();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -6,5 +6,5 @@
|
|||
*/
|
||||
|
||||
export default function isInternalUrl(url) {
|
||||
return /^(https?:|\/\/)/.test(url) === false;
|
||||
return /^(https?:|\/\/|mailto:|tel:)/.test(url) === false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue