aboutsummaryrefslogtreecommitdiff
path: root/bg
diff options
context:
space:
mode:
authorhackademix <giorgio@maone.net>2018-09-30 00:12:17 +0200
committerhackademix <giorgio@maone.net>2018-09-30 00:12:17 +0200
commitffe9a7ab8625aba7a60e21f4c7f2c39081414697 (patch)
tree157cb4e23fddc439c7e201635fbd35532a8be961 /bg
parent423c752f06eeebaa1d190751ac91ca3fdcd9cf8d (diff)
WebLabels matching by id made case-insensitive.
Diffstat (limited to 'bg')
-rw-r--r--bg/ExternalLicenses.js11
1 files changed, 6 insertions, 5 deletions
diff --git a/bg/ExternalLicenses.js b/bg/ExternalLicenses.js
index 058b651..33bcbf6 100644
--- a/bg/ExternalLicenses.js
+++ b/bg/ExternalLicenses.js
@@ -29,18 +29,19 @@ let licensesByLabel = new Map();
let licensesByUrl = new Map();
{
let {licenses} = require("../license_definitions");
+ let mapByLabel = (label, license) => licensesByLabel.set(label.toUpperCase(), license);
for (let [id, l] of Object.entries(licenses)) {
let {identifier, canonicalUrl, licenseName} = l;
if (identifier) {
- licensesByLabel.set(identifier, l);
+ mapByLabel(identifier, l);
} else {
l.identifier = id;
}
if (id !== identifier) {
- licensesByLabel.set(id, l);
+ mapByLabel(id, l);
}
if (licenseName) {
- licensesByLabel.set(licenseName, l);
+ mapByLabel(licenseName, l);
}
if (Array.isArray(canonicalUrl)) {
for (let url of canonicalUrl) {
@@ -87,9 +88,9 @@ var ExternalLicenses = {
};
for (let {label, url} of scriptInfo.licenseLinks) {
- match(licensesByLabel, label = label.trim()) ||
+ match(licensesByLabel, label = label.trim().toUpperCase()) ||
match(licensesByUrl, url) ||
- match(licensesByLabel, label.replace(/^GNU-|-(?:or-later|only)$/i, ''));
+ match(licensesByLabel, label.replace(/^GNU-|-(?:OR-LATER|ONLY)$/, ''));
}
scriptInfo.free = scriptInfo.licenses.size > 0;
return scriptInfo;