Avoid use of DB rollback() in LocalFileMoveBatch
[lhc/web/wiklou.git] / includes / media / MediaTransformOutput.php
index 9176b54..b3a555a 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 ] );