From 8d52a21598c92a76a36cba4e16364a546afff509 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gerg=C5=91=20Tisza?= Date: Wed, 26 Aug 2015 14:18:54 -0700 Subject: [PATCH] Return HTTP 429 when thumbnailing is throttled due to too many errors Bug: T110109 Change-Id: I8af527661a041964690faae7566fb97e305e2b0f --- thumb.php | 3 +++ 1 file changed, 3 insertions(+) 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() ) { -- 2.20.1