Update ImageUtilities.plugin.js

This commit is contained in:
Mirco Wittrien 2022-08-30 07:34:32 +02:00 committed by GitHub
parent d96f9f2ecf
commit 229a69c3e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -1433,7 +1433,7 @@ module.exports = (_ => {
url = url.startsWith("/assets") ? (window.location.origin + url) : url;
BDFDB.LibraryRequires.request(url, {agentOptions: {rejectUnauthorized: false}, encoding: null}, (error, response, body) => {
let type = this.isValid(url, "video") ? BDFDB.LanguageUtils.LanguageStrings.VIDEO : BDFDB.LanguageUtils.LanguageStrings.IMAGE;
if (error || response.statusCode != 200 || response.headers["content-type"] == "text/html") {
if (error || response.statusCode != 200 || response.headers["content-type"].indexOf("text/html") > -1) {
if (fallbackUrl) this.downloadFile(fallbackUrl, path, null, alternativeName);
else BDFDB.NotificationUtils.toast(this.labels.toast_save_failed.replace("{{var0}}", type).replace("{{var1}}", ""), {type: "danger"});
}
@ -1450,7 +1450,7 @@ module.exports = (_ => {
url = url.startsWith("/assets") ? (window.location.origin + url) : url;
BDFDB.LibraryRequires.request(url, {agentOptions: {rejectUnauthorized: false}, encoding: null}, (error, response, body) => {
let type = this.isValid(url, "video") ? BDFDB.LanguageUtils.LanguageStrings.VIDEO : BDFDB.LanguageUtils.LanguageStrings.IMAGE;
if (error || response.statusCode != 200 || response.headers["content-type"] == "text/html") {
if (error || response.statusCode != 200 || response.headers["content-type"].indexOf("text/html") > -1) {
if (fallbackUrl) this.downloadFileAs(fallbackUrl, null, alternativeName);
else BDFDB.NotificationUtils.toast(this.labels.toast_save_failed.replace("{{var0}}", type).replace("{{var1}}", ""), {type: "danger"});
}