jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/333079 )

Change subject: Special:Upload should not crash on failing previews
......................................................................


Special:Upload should not crash on failing previews

A thumbnail transformation can fail, but the preview on Special:Upload
was not accounting for failed previews and caused a stacktrace on
accessing getUrl on 'false'.

Bug: T155771
Change-Id: Iff3a2ae3512a34a2d2efb981b7ea85da71aaf637
---
M includes/specials/SpecialUpload.php
1 file changed, 8 insertions(+), 6 deletions(-)

Approvals:
  Bartosz Dziewoński: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/specials/SpecialUpload.php 
b/includes/specials/SpecialUpload.php
index 8b8e514..c5a1f27 100644
--- a/includes/specials/SpecialUpload.php
+++ b/includes/specials/SpecialUpload.php
@@ -1090,12 +1090,14 @@
                                global $wgContLang;
 
                                $mto = $file->transform( [ 'width' => 120 ] );
-                               $this->addHeaderText(
-                                       '<div class="thumb t' . 
$wgContLang->alignEnd() . '">' .
-                                       Html::element( 'img', [
-                                               'src' => $mto->getUrl(),
-                                               'class' => 'thumbimage',
-                                       ] ) . '</div>', 'description' );
+                               if ( $mto ) {
+                                       $this->addHeaderText(
+                                               '<div class="thumb t' . 
$wgContLang->alignEnd() . '">' .
+                                               Html::element( 'img', [
+                                                       'src' => $mto->getUrl(),
+                                                       'class' => 'thumbimage',
+                                               ] ) . '</div>', 'description' );
+                               }
                        }
                }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/333079
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iff3a2ae3512a34a2d2efb981b7ea85da71aaf637
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: TheDJ <[email protected]>
Gerrit-Reviewer: Bartosz Dziewoński <[email protected]>
Gerrit-Reviewer: Brion VIBBER <[email protected]>
Gerrit-Reviewer: Florianschmidtwelzow <[email protected]>
Gerrit-Reviewer: MarkTraceur <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to