Update ImageUtilities.plugin.js

This commit is contained in:
Mirco Wittrien 2021-03-02 14:23:42 +01:00 committed by GitHub
parent 63beae64f4
commit e4957d6ec4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -529,8 +529,8 @@ module.exports = (_ => {
injectItem (e, ...urls) {
let fileTypes = [];
let validUrls = urls.filter(n => this.isValid(n)).map(n => {
let originalUrl = n;
let url = originalUrl.replace(/^url\(|\)$|"|'/g, "").replace(/\?size\=\d+$/, "?size=4096").replace(/[\?\&](height|width)=\d+/g, "").replace(/%3A/g, ":");
let originalUrl = n.replace(/^url\(|\)$|"|'/g, "").replace(/\?size\=\d+$/, "?size=4096");
let url = originalUrl.replace(/[\?\&](height|width)=\d+/g, "").replace(/%3A/g, ":");
if (url.indexOf("https://images-ext-1.discordapp.net/external/") > -1 || url.indexOf("https://images-ext-2.discordapp.net/external/") > -1) {
if (url.split("/https/").length > 1) url = "https://" + url.split("/https/").pop();
else if (url.split("/http/").length > 1) url = "http://" + url.split("/http/").pop();
@ -1499,4 +1499,4 @@ module.exports = (_ => {
}
};
})(window.BDFDB_Global.PluginUtils.buildPlugin(config));
})();
})();