diff --git a/lib/exitProcessOrWarnIfNeeded.js b/lib/exitProcessOrWarnIfNeeded.js index 8182a61..d3aab33 100644 --- a/lib/exitProcessOrWarnIfNeeded.js +++ b/lib/exitProcessOrWarnIfNeeded.js @@ -1,6 +1,6 @@ const usageMessage = require('./usageMessage'); -module.exports = function exitProcessOrWarnIfNeeded ({ unknownArgs, parsedArgs, hasFailingArg }) { +module.exports = function exitProcessOrWarnIfNeeded({ unknownArgs, parsedArgs, hasFailingArg }) { if (unknownArgs.length) { console.error(`license-checker-rseidelsohn@${require('../package.json').version}`, '\n'); console.error( @@ -35,4 +35,4 @@ module.exports = function exitProcessOrWarnIfNeeded ({ unknownArgs, parsedArgs, `Warning: The --${argName} argument takes semicolons as delimeters instead of commas (some license names can contain commas)`, ); } -} +}; diff --git a/lib/getLicenseTitle.js b/lib/getLicenseTitle.js index eaf6d12..0105455 100644 --- a/lib/getLicenseTitle.js +++ b/lib/getLicenseTitle.js @@ -21,6 +21,7 @@ const CC0_1_0 = /The\s+person\s+who\s+associated\s+a\s+work\s+with\s+this\s+deed\s+has\s+dedicated\s+the\s+work\s+to\s+the\s+public\s+domain\s+by\s+waiving\s+all\s+of\s+his\s+or\s+her\s+rights\s+to\s+the\s+work\s+worldwide\s+under\s+copyright\s+law,\s+including\s+all\s+related\s+and\s+neighboring\s+rights,\s+to\s+the\s+extent\s+allowed\s+by\s+law.\s+You\s+can\s+copy,\s+modify,\s+distribute\s+and\s+perform\s+the\s+work,\s+even\s+for\s+commercial\s+purposes,\s+all\s+without\s+asking\s+permission./i; // jshint ignore:line const PUBLIC_DOMAIN = /[Pp]ublic[\-_ ]*[Dd]omain/; const IS_URL = /(https?:\/\/[-a-zA-Z0-9\/.]*)/; +const DISCARD_URLS_ENDING_WITH = /(.svg|.gif|.png|.jpg|.jpeg)$/i; const IS_FILE_REFERENCE = /SEE LICENSE IN (.*)/i; const UNLICENSED = /UNLICENSED/i; @@ -160,7 +161,11 @@ module.exports = function getLicenseTitle(str = 'undefined') { match = IS_URL.exec(str) || IS_FILE_REFERENCE.exec(str); if (match) { - return 'Custom: ' + match[1]; + const matchedUrl = match[1]; + + if (!DISCARD_URLS_ENDING_WITH.test(matchedUrl)) { + return `Custom: ${matchedUrl}`; + } } else { return null; }