From 4b13d4cf99fd1fe3bc425996eb3d38dc0ea58dfa Mon Sep 17 00:00:00 2001 From: Sebastiano Morando Date: Fri, 29 Sep 2017 23:58:37 +0200 Subject: [PATCH] fix: ignore attribute if `mailto:` is present (#145) --- index.js | 2 ++ test/loaderTest.js | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/index.js b/index.js index 88527455..8465da00 100644 --- a/index.js +++ b/index.js @@ -53,6 +53,8 @@ module.exports = function(content) { content = [content]; links.forEach(function(link) { if(!loaderUtils.isUrlRequest(link.value, root)) return; + + if (link.value.indexOf('mailto:') > -1 ) return; var uri = url.parse(link.value); if (uri.hash !== null && uri.hash !== undefined) { diff --git a/test/loaderTest.js b/test/loaderTest.js index dedb3d32..b5957dc1 100644 --- a/test/loaderTest.js +++ b/test/loaderTest.js @@ -150,6 +150,11 @@ describe("loader", function() { 'module.exports = "";' ); }); + it("should ignore anchor with 'mailto:' in the href attribute", function() { + loader.call({}, '').should.be.eql( + 'module.exports = "";' + ); + }); it("should ignore interpolations by default", function() { loader.call({}, '').should.be.eql( 'module.exports = "";'