Image Utitilies - Fix context menu downloads

This commit is contained in:
deathbyprograms 2024-11-22 15:49:32 -07:00
parent 220bba7ef1
commit 1ab2a18cfc
No known key found for this signature in database
GPG Key ID: 0CB3535349A69C3A
1 changed files with 2 additions and 2 deletions

View File

@ -1546,9 +1546,9 @@ module.exports = (_ => {
requestFile (urls, onLoad, onError, config = {}) { requestFile (urls, onLoad, onError, config = {}) {
if (!urls || typeof onLoad != "function") return typeof onError == "function" && onError(); if (!urls || typeof onLoad != "function") return typeof onError == "function" && onError();
let url = (urls.url && urls.url.startsWith("/assets") ? (window.location.origin + urls.url) : urls.url || ""); let url = (urls.url && urls.url.startsWith("/assets") ? (window.location.origin + urls.url) : urls.url || "");
let isResized = !config.orignalSizeChecked && (url.indexOf("?width=") > -1 || url.indexOf("?height=") > -1 || url.indexOf("?size=") > -1); let isResized = !config.orignalSizeChecked && (url.indexOf("width=") > -1 || url.indexOf("height=") > -1 || url.indexOf("size=") > -1);
url = isResized ? this.removeSizeInUrl(url) : url; url = isResized ? this.removeSizeInUrl(url) : url;
let isFormatted = (url.indexOf("?format=") > -1); let isFormatted = (url.indexOf("format=") > -1);
url = isFormatted ? this.removeFormatInUrl(url) : url; url = isFormatted ? this.removeFormatInUrl(url) : url;
url = url.indexOf("discordapp.com/avatars/") > 0 || url.indexOf("discordapp.com/icons/") > 0 ? `${url}?size=4096` : url; url = url.indexOf("discordapp.com/avatars/") > 0 || url.indexOf("discordapp.com/icons/") > 0 ? `${url}?size=4096` : url;
BDFDB.LibraryRequires.request(url, {toBuffer: true}, (error, response, buffer) => { BDFDB.LibraryRequires.request(url, {toBuffer: true}, (error, response, buffer) => {