]> source.dussan.org Git - nextcloud-server.git/commitdiff
Added fix to correctly parse non-array error messages
authorVincent Petry <pvince81@owncloud.com>
Tue, 29 Oct 2013 15:00:34 +0000 (16:00 +0100)
committerVincent Petry <pvince81@owncloud.com>
Tue, 29 Oct 2013 15:00:34 +0000 (16:00 +0100)
Some apps like the antivirus app return messages in a non-array format.

apps/files/js/file-upload.js

index 5bf4f5c09819b601eae9f5e2178b266c28dc730a..95c0723f254d115556c9e0c0ccf193f75a28682d 100644 (file)
@@ -334,8 +334,13 @@ $(document).ready(function() {
                                var result=$.parseJSON(response);
 
                                delete data.jqXHR;
-                               
-                               if (typeof result[0] === 'undefined') {
+
+                               if (result.status === 'error' && result.data && result.data.message){
+                                       data.textStatus = 'servererror';
+                                       data.errorThrown = result.data.message;
+                                       var fu = $(this).data('blueimp-fileupload') || $(this).data('fileupload');
+                                       fu._trigger('fail', e, data);
+                               } else if (typeof result[0] === 'undefined') {
                                        data.textStatus = 'servererror';
                                        data.errorThrown = t('files', 'Could not get result from server.');
                                        var fu = $(this).data('blueimp-fileupload') || $(this).data('fileupload');