Make WordPress Core

Changeset 46566


Ignore:
Timestamp:
10/21/2019 10:42:02 PM (7 years ago)
Author:
azaozz
Message:

Upload: Expand error codes to include all 5xx HTTP errors when retrying to create image sub-sizes. Some servers may be configured to set HTTP 508 or 504, or possibly other 5 errors.

Porps mikeschroder, azaozz.
Fixes #48379.

Location:
trunk/src/js/_enqueues/vendor/plupload
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/vendor/plupload/handlers.js

    r46506 r46566  
    428428
    429429        // Attempt to create image sub-sizes when an image was uploaded successfully
    430         // but the server responded with an HTTP 500 or 502 error.
     430        // but the server responded with an HTTP 5xx error.
    431431        tryAgain = function( up, error ) {
    432432                var file = error.file;
    … …  
    466466                        });
    467467
    468                         if ( error.message && error.status !== 500 && error.status !== 502 ) {
     468                        if ( error.message && ( error.status < 500 || error.status >= 600 ) ) {
    469469                                wpQueueError( error.message );
    470470                        } else {
    … …  
    505505                        }
    506506                }).fail( function( jqXHR ) {
    507                         // If another HTTP 500 error, try try again...
    508                         if ( jqXHR.status === 500 || jqXHR.status === 502 ) {
     507                        // If another HTTP 5xx error, try try again...
     508                        if ( jqXHR.status >= 500 && jqXHR.status < 600 ) {
    509509                                tryAgain( up, error );
    510510                                return;
    … …  
    583583                        var status  = error && error.status;
    584584
    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 ) {
     585                        // If the file is an image and the error is HTTP 5xx try to create sub-sizes again.
     586                        if ( isImage && status >= 500 && status < 600 ) {
    587587                                tryAgain( up, error );
    588588                                return;
  • trunk/src/js/_enqueues/vendor/plupload/wp-plupload.js

    r46506 r46566  
    110110                /**
    111111                 * Attempt to create image sub-sizes when an image was uploaded successfully
    112                  * but the server responded with HTTP 500 or 502 error.
     112                 * but the server responded with HTTP 5xx error.
    113113                 *
    114114                 * @since 5.3.0
    … …  
    185185                                }
    186186                        }).fail( function( jqXHR ) {
    187                                 // If another HTTP 500 or 502 error, try try again...
    188                                 if ( jqXHR.status === 500 || jqXHR.status === 502 ) {
     187                                // If another HTTP 5xx error, try try again...
     188                                if ( jqXHR.status >= 500 && jqXHR.status < 600 ) {
    189189                                        tryAgain( message, data, file );
    190190                                        return;
    … …  
    210210                        var status  = data && data.status;
    211211
    212                         // If the file is an image and the error is HTTP 500 or 502 try to create sub-sizes again.
    213                         if ( retry !== 'no-retry' && isImage && ( status === 500 || status === 502 ) ) {
     212                        // If the file is an image and the error is HTTP 5xx try to create sub-sizes again.
     213                        if ( retry !== 'no-retry' && isImage && status >= 500 && status < 600 ) {
    214214                                tryAgain( message, data, file );
    215215                                return;
Note: See TracChangeset for help on using the changeset viewer.