From: Gergő Tisza Date: Wed, 26 Aug 2015 21:18:54 +0000 (-0700) Subject: Return HTTP 429 when thumbnailing is throttled due to too many errors X-Git-Tag: 1.31.0-rc.0~10258^2 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=8d52a21598c92a76a36cba4e16364a546afff509 Return HTTP 429 when thumbnailing is throttled due to too many errors Bug: T110109 Change-Id: I8af527661a041964690faae7566fb97e305e2b0f --- diff --git a/thumb.php b/thumb.php index eea6ddafa6..f5eb8c991e 100644 --- a/thumb.php +++ b/thumb.php @@ -332,6 +332,9 @@ function wfStreamThumb( array $params ) { $errorCode = 500; if ( !$thumb ) { $errorMsg = $errorMsg ?: $msg->rawParams( 'File::transform() returned false' )->escaped(); + if ( $errorMsg instanceof MessageSpecifier && $errorMsg->getKey() === 'thumbnail_image-failure-limit' ) { + $errorCode = 429; + } } elseif ( $thumb->isError() ) { $errorMsg = $thumb->getHtmlMsg(); } elseif ( !$thumb->hasFile() ) {