diff --git a/lib/core/file.js b/lib/core/file.js index ec438ed71..eca136b13 100644 --- a/lib/core/file.js +++ b/lib/core/file.js @@ -24,7 +24,7 @@ class File { // Only supported in Solidity return callback(null, content); } - const regex = /import ["|']([a-zA-Z0-9_\-.\\\/:]+)";/g; + const regex = /import ["|']([-a-zA-Z0-9@:%_+.~#?&\/=]+)["|'];/g; let matches; const filesToDownload = []; const pathWithoutFile = path.dirname(self.path); diff --git a/lib/utils/utils.js b/lib/utils/utils.js index 2d85d9604..0063c1ec3 100644 --- a/lib/utils/utils.js +++ b/lib/utils/utils.js @@ -148,7 +148,7 @@ function getExternalContractUrl(file) { // [4] path // [5] branch const match = file.match( - /(git:\/\/)?github\.[a-z]+\/([a-zA-Z0-9_\-.]+)\/([a-zA-Z0-9_\-]+)\/([a-zA-Z0-9_\-\/.]+)#?([a-zA-Z0-1_\-.]*)?/ + /(git:\/\/)?github\.[a-z]+\/([-a-zA-Z0-9@:%_+.~#?&=]+)\/([-a-zA-Z0-9@:%_+.~#?&=]+)\/([-a-zA-Z0-9@:%_+.~?\/&=]+)#?([a-zA-Z0-1\/_.-]*)?/ ); if (!match) { console.error(MALFORMED_ERROR + file); @@ -165,7 +165,7 @@ function getExternalContractUrl(file) { return null; } const match = url.match( - /\.[a-z]+\/([a-zA-Z0-9_\-\/.]+)/ + /\.[a-z]+\/([-a-zA-Z0-9@:%_+.~#?&\/=]+)/ ); return { url, diff --git a/test/test.js b/test/utils.js similarity index 100% rename from test/test.js rename to test/utils.js