From 440299e661235d34f5897b930f0932a6f0b7c413 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Mon, 28 Aug 2023 22:23:02 -0400 Subject: [PATCH 1/2] fix: don't try to parse response if request is head #11960 --- public/src/modules/api.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/public/src/modules/api.js b/public/src/modules/api.js index bfda975662..db8e0fb1b0 100644 --- a/public/src/modules/api.js +++ b/public/src/modules/api.js @@ -69,18 +69,23 @@ async function xhr(options, cb) { const isJSON = contentType && contentType.startsWith('application/json'); let response; - if (isJSON) { - response = await res.json(); - } else { - response = await res.text(); + if (options.method !== 'head') { + if (isJSON) { + response = await res.json(); + } else { + response = await res.text(); + } } if (!res.ok) { - return cb(new Error(isJSON ? response.status.message : response)); + if (response) { + return cb(new Error(isJSON ? response.status.message : response)); + } + return cb(new Error(res.statusText)); } cb(null, ( - isJSON && response.hasOwnProperty('status') && response.hasOwnProperty('response') ? + isJSON && response && response.hasOwnProperty('status') && response.hasOwnProperty('response') ? response.response : response )); From 90ac82d0175ebd29359ca7f2ed1f51e2a1de63e7 Mon Sep 17 00:00:00 2001 From: NoScripter Date: Tue, 29 Aug 2023 23:17:09 +0800 Subject: [PATCH 2/2] fix: remove og:image value (#11966) --- public/src/admin/settings/general.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/src/admin/settings/general.js b/public/src/admin/settings/general.js index 65f1f0bce4..019cbcdeca 100644 --- a/public/src/admin/settings/general.js +++ b/public/src/admin/settings/general.js @@ -18,7 +18,7 @@ define('admin/settings/general', ['admin/settings'], function () { $('input[data-field="brand:maskableIcon"]').val(''); }); $('button[data-action="removeOgImage"]').on('click', function () { - $('input[data-field="removeOgImage"]').val(''); + $('input[data-field="og:image"]').val(''); }); $('[data-field="homePageRoute"]').on('change', toggleCustomRoute);