mirror of
https://github.com/nextcloud/server.git
synced 2026-05-19 08:25:56 -04:00
Fix handling of internal errors when uploading theming files
When a file can not be uploaded in the Theming app due to an expected error (like an invalid mime type) the response contains a "data.message" field. However, if the upload fails due to an unexpected error (like an internal error, for example if the "mime_content_type" function is disabled) there is no such field, so it should not be used. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
parent
7f02be6010
commit
46d5ece3a6
1 changed files with 2 additions and 1 deletions
|
|
@ -137,7 +137,8 @@ window.addEventListener('DOMContentLoaded', function () {
|
|||
},
|
||||
fail: function (e, response){
|
||||
var $form = $(e.target).closest('form');
|
||||
OC.msg.finishedError('#theming_settings_msg', response._response.jqXHR.responseJSON.data.message);
|
||||
const responseJSON = response._response.jqXHR.responseJSON;
|
||||
OC.msg.finishedError('#theming_settings_msg', responseJSON && responseJSON.data && responseJSON.data.message ? responseJSON.data.message : t('theming', 'Error uploading the file'));
|
||||
$form.find('label.button').addClass('icon-upload').removeClass('icon-loading-small');
|
||||
$('#theming_settings_loading').hide();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue