Node.js based forum software built for the modern web
fix: upload modal error handler
Julian Lamdd8719a10e61
diff --git a/public/language/en-GB/error.json b/public/language/en-GB/error.jsonindex a4ae4d1e38..eb7dfd4b33 100644--- a/public/language/en-GB/error.json+++ b/public/language/en-GB/error.json@@ -115,6 +115,7 @@"guest-upload-disabled": "Guest uploading has been disabled","cors-error": "Unable to upload image due to misconfigured CORS","upload-ratelimit-reached": "You have uploaded too many files at one time. Please try again later.",+ "upload-error-fallback": "Unable to upload image — %1","scheduling-to-past": "Please select a date in the future.","invalid-schedule-date": "Please enter a valid date and time.",diff --git a/public/src/modules/uploader.js b/public/src/modules/uploader.jsindex 8aa010871a..a9e91e7631 100644--- a/public/src/modules/uploader.js+++ b/public/src/modules/uploader.js@@ -72,7 +72,7 @@ define('uploader', ['jquery-form'], function () {},error: function (xhr) {xhr = maybeParse(xhr);- showAlert(uploadModal, 'error', xhr.responseJSON ? (xhr.responseJSON.error || xhr.statusText) : 'error uploading, code : ' + xhr.status);+ showAlert(uploadModal, 'error', xhr.responseJSON?.status?.message || `[[error:upload-error-fallback, ${xhr.status} ${xhr.statusText}]]`);},uploadProgress: function (event, position, total, percent) {uploadModal.find('#upload-progress-bar').css('width', percent + '%');