Make WordPress Core

Ticket #47872: 47872.2.diff

File 47872.2.diff, 1.7 KB (added by kirasong, 5 years ago)

Expand error code to include 502.

  • src/js/_enqueues/vendor/plupload/handlers.js

    diff --git src/js/_enqueues/vendor/plupload/handlers.js src/js/_enqueues/vendor/plupload/handlers.js
    index fbf1012f9c..0e8280ba46 100644
    jQuery( document ).ready( function( $ ) { 
    427427        });
    428428
    429429        // Attempt to create image sub-sizes when an image was uploaded successfully
    430         // but the server responded with HTTP 500 error.
     430        // but the server responded with an HTTP 500 or 502 error.
    431431        tryAgain = function( up, error ) {
    432432                var file = error.file;
    433433                var times;
    jQuery( document ).ready( function( $ ) { 
    465465                                }
    466466                        });
    467467
    468                         if ( error.message && error.status !== 500 ) {
     468                        if ( error.message && error.status !== 500 && error.status !== 502  ) {
    469469                                wpQueueError( error.message );
    470470                        } else {
    471471                                wpQueueError( pluploadL10n.http_error_image );
    jQuery( document ).ready( function( $ ) { 
    505505                        }
    506506                }).fail( function( jqXHR ) {
    507507                        // If another HTTP 500 error, try try again...
    508                         if ( jqXHR.status === 500 ) {
     508                        if ( jqXHR.status === 500 || jqXHR.status === 502 ) {
    509509                                tryAgain( up, error );
    510510                                return;
    511511                        }
    jQuery( document ).ready( function( $ ) { 
    582582                        var isImage = error.file && error.file.type && error.file.type.indexOf( 'image/' ) === 0;
    583583                        var status  = error && error.status;
    584584
    585                         // If the file is an image and the error is HTTP 500 try to create sub-sizes again.
    586                         if ( status === 500 && isImage ) {
     585                        // If the file is an image and the error is HTTP 500 or 502 try to create sub-sizes again.
     586                        if ( ( status === 500 || status === 502 ) && isImage ) {
    587587                                tryAgain( up, error );
    588588                                return;
    589589                        }