jenkins-bot has submitted this change and it was merged.

Change subject: In imageinfo, check for invalid title
......................................................................


In imageinfo, check for invalid title

If an image is requested which has an invalid title, pretend it doesn't
exist, by not adding it to the findFiles() batch. This avoids a fatal
error, and the HTML result is not too bad. For the HTML to really be
correct, Parsoid would detect the invalid title prior to sending the
batch and not even try to construct an image link (this is T113322).

Bug: T114048
Change-Id: I77fd7e8853feeeec89961fe4415d0975270710c4
---
M includes/ApiParsoidBatch.php
1 file changed, 3 insertions(+), 1 deletion(-)

Approvals:
  Catrope: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/ApiParsoidBatch.php b/includes/ApiParsoidBatch.php
index 9a33a64..f443fcf 100644
--- a/includes/ApiParsoidBatch.php
+++ b/includes/ApiParsoidBatch.php
@@ -42,7 +42,9 @@
                                // Normalize the filename in $batch so that we 
can find the corresponding
                                // file in the findFiles() result
                                $title = Title::makeTitleSafe( NS_FILE, 
$itemParams['filename'] );
-                               $filenames[] = $batch[$itemIndex]['filename'] = 
$title->getDBkey();
+                               if ( $title ) {
+                                       $filenames[] = 
$batch[$itemIndex]['filename'] = $title->getDBkey();
+                               }
                        } else {
                                $this->dieUsage( "Invalid action in item index 
$itemIndex", 'invalid_action' );
                        }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I77fd7e8853feeeec89961fe4415d0975270710c4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ParsoidBatchAPI
Gerrit-Branch: master
Gerrit-Owner: Tim Starling <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to