X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fmedia%2FMediaTransformOutput.php;h=46b96745faca6c9bb3c148f2f712cb291562a857;hb=5a1104444f3d71d3f696f130de79b315f86e15cc;hp=9176b546668ca682f5951469d60c5ae021850148;hpb=e5facc46bc170c302438f60849041b0d6be75e82;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/media/MediaTransformOutput.php b/includes/media/MediaTransformOutput.php index 9176b54666..46b96745fa 100644 --- a/includes/media/MediaTransformOutput.php +++ b/includes/media/MediaTransformOutput.php @@ -421,8 +421,10 @@ class ThumbnailImage extends MediaTransformOutput { } // Additional densities for responsive images, if specified. - if ( !empty( $this->responsiveUrls ) ) { - $attribs['srcset'] = Html::srcSet( $this->responsiveUrls ); + // If any of these urls is the same as src url, it'll be excluded. + $responsiveUrls = array_diff( $this->responsiveUrls, [ $this->url ] ); + if ( !empty( $responsiveUrls ) ) { + $attribs['srcset'] = Html::srcSet( $responsiveUrls ); } Hooks::run( 'ThumbnailBeforeProduceHTML', [ $this, &$attribs, &$linkAttribs ] ); @@ -474,6 +476,10 @@ class MediaTransformError extends MediaTransformOutput { function isError() { return true; } + + function getHttpStatusCode() { + return 500; + } } /** @@ -488,6 +494,10 @@ class TransformParameterError extends MediaTransformError { max( isset( $params['height'] ) ? $params['height'] : 0, 120 ), wfMessage( 'thumbnail_invalid_params' )->text() ); } + + function getHttpStatusCode() { + return 400; + } } /** @@ -509,4 +519,8 @@ class TransformTooBigImageAreaError extends MediaTransformError { )->text() ); } + + function getHttpStatusCode() { + return 400; + } }