Merge "Added warning for improper ending of a token"
[lhc/web/wiklou.git] / includes / media / MediaTransformOutput.php
index 9176b54..46b9674 100644 (file)
@@ -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;
+       }
 }