| @@ -8,9 +8,13 @@ | ||
| 8 | 8 | /** |
| 9 | 9 | * This is the standard uploader response handler. |
| 10 | 10 | */ |
| 11 | 11 | handleStandardResponse: function ( response, file ) { |
| 12 | - if ( ! _.isObject( response ) || _.isUndefined( response.success ) ) { | |
| 12 | + if ( | |
| 13 | + response === null || | |
| 14 | + typeof response !== 'object' || | |
| 15 | + typeof response.success === 'undefined' | |
| 16 | + ) { | |
| 13 | 17 | return error( pluploadL10n.default_error, null, file ); |
| 14 | 18 | } else if ( ! response.success ) { |
| 15 | 19 | return error( response.data && response.data.message, response.data, file ); |
| 16 | 20 | } |
| @@ -133,23 +137,19 @@ | ||
| 133 | 137 | response: response, |
| 134 | 138 | } ); |
| 135 | 139 | cb( false ); |
| 136 | 140 | } ); |
| 141 | + } else if ( typeof file.size !== 'undefined' && maxSize && file.size > maxSize ) { | |
| 142 | + // Invalid file size | |
| 143 | + this.trigger( 'Error', { | |
| 144 | + code: plupload.FILE_SIZE_ERROR, | |
| 145 | + message: plupload.translate( 'File size error.' ), | |
| 146 | + file: file, | |
| 147 | + } ); | |
| 148 | + cb( false ); | |
| 137 | 149 | } else { |
| 138 | 150 | // Handles the normal max_file_size functionality. |
| 139 | - var undef; | |
| 140 | - | |
| 141 | - // Invalid file size | |
| 142 | - if ( file.size !== undef && maxSize && file.size > maxSize ) { | |
| 143 | - this.trigger( 'Error', { | |
| 144 | - code: plupload.FILE_SIZE_ERROR, | |
| 145 | - message: plupload.translate( 'File size error.' ), | |
| 146 | - file: file, | |
| 147 | - } ); | |
| 148 | - cb( false ); | |
| 149 | - } else { | |
| 150 | - cb( true ); | |
| 151 | - } | |
| 151 | + cb( true ); | |
| 152 | 152 | } |
| 153 | 153 | } ); |
| 154 | 154 | } |
| 155 | 155 | |