Tim Starling has uploaded a new change for review.
https://gerrit.wikimedia.org/r/241961
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(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ParsoidBatchAPI
refs/changes/61/241961/1
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: newchange
Gerrit-Change-Id: I77fd7e8853feeeec89961fe4415d0975270710c4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ParsoidBatchAPI
Gerrit-Branch: master
Gerrit-Owner: Tim Starling <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits