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. git-svn-id: https://develop.svn.wordpress.org/trunk@46566 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
c424187b6e
commit
295acd4f95
12
src/js/_enqueues/vendor/plupload/handlers.js
vendored
12
src/js/_enqueues/vendor/plupload/handlers.js
vendored
@ -427,7 +427,7 @@ jQuery( document ).ready( function( $ ) {
|
||||
});
|
||||
|
||||
// Attempt to create image sub-sizes when an image was uploaded successfully
|
||||
// but the server responded with an HTTP 500 or 502 error.
|
||||
// but the server responded with an HTTP 5xx error.
|
||||
tryAgain = function( up, error ) {
|
||||
var file = error.file;
|
||||
var times;
|
||||
@ -465,7 +465,7 @@ jQuery( document ).ready( function( $ ) {
|
||||
}
|
||||
});
|
||||
|
||||
if ( error.message && error.status !== 500 && error.status !== 502 ) {
|
||||
if ( error.message && ( error.status < 500 || error.status >= 600 ) ) {
|
||||
wpQueueError( error.message );
|
||||
} else {
|
||||
wpQueueError( pluploadL10n.http_error_image );
|
||||
@ -504,8 +504,8 @@ jQuery( document ).ready( function( $ ) {
|
||||
wpQueueError( message || pluploadL10n.http_error_image );
|
||||
}
|
||||
}).fail( function( jqXHR ) {
|
||||
// If another HTTP 500 error, try try again...
|
||||
if ( jqXHR.status === 500 || jqXHR.status === 502 ) {
|
||||
// If another HTTP 5xx error, try try again...
|
||||
if ( jqXHR.status >= 500 && jqXHR.status < 600 ) {
|
||||
tryAgain( up, error );
|
||||
return;
|
||||
}
|
||||
@ -582,8 +582,8 @@ jQuery( document ).ready( function( $ ) {
|
||||
var isImage = error.file && error.file.type && error.file.type.indexOf( 'image/' ) === 0;
|
||||
var status = error && error.status;
|
||||
|
||||
// If the file is an image and the error is HTTP 500 or 502 try to create sub-sizes again.
|
||||
if ( ( status === 500 || status === 502 ) && isImage ) {
|
||||
// If the file is an image and the error is HTTP 5xx try to create sub-sizes again.
|
||||
if ( isImage && status >= 500 && status < 600 ) {
|
||||
tryAgain( up, error );
|
||||
return;
|
||||
}
|
||||
|
10
src/js/_enqueues/vendor/plupload/wp-plupload.js
vendored
10
src/js/_enqueues/vendor/plupload/wp-plupload.js
vendored
@ -109,7 +109,7 @@ window.wp = window.wp || {};
|
||||
|
||||
/**
|
||||
* Attempt to create image sub-sizes when an image was uploaded successfully
|
||||
* but the server responded with HTTP 500 or 502 error.
|
||||
* but the server responded with HTTP 5xx error.
|
||||
*
|
||||
* @since 5.3.0
|
||||
*
|
||||
@ -184,8 +184,8 @@ window.wp = window.wp || {};
|
||||
error( message, data, file, 'no-retry' );
|
||||
}
|
||||
}).fail( function( jqXHR ) {
|
||||
// If another HTTP 500 or 502 error, try try again...
|
||||
if ( jqXHR.status === 500 || jqXHR.status === 502 ) {
|
||||
// If another HTTP 5xx error, try try again...
|
||||
if ( jqXHR.status >= 500 && jqXHR.status < 600 ) {
|
||||
tryAgain( message, data, file );
|
||||
return;
|
||||
}
|
||||
@ -209,8 +209,8 @@ window.wp = window.wp || {};
|
||||
var isImage = file.type && file.type.indexOf( 'image/' ) === 0;
|
||||
var status = data && data.status;
|
||||
|
||||
// If the file is an image and the error is HTTP 500 or 502 try to create sub-sizes again.
|
||||
if ( retry !== 'no-retry' && isImage && ( status === 500 || status === 502 ) ) {
|
||||
// If the file is an image and the error is HTTP 5xx try to create sub-sizes again.
|
||||
if ( retry !== 'no-retry' && isImage && status >= 500 && status < 600 ) {
|
||||
tryAgain( message, data, file );
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user