Phuedx has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/172258

Change subject: Die with an error if the title redirects to media
......................................................................

Die with an error if the title redirects to media

ApiMobileView#getData returns an empty array if the title redirects to a
page in a virtual namespace (NS_SPECIAL, NS_MEDIA). Die with an error
when this happens.

Bug: 73109
Change-Id: I3005453645daf205523c2640b6e5be77a91e6a69
---
M includes/api/ApiMobileView.php
1 file changed, 5 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/58/172258/1

diff --git a/includes/api/ApiMobileView.php b/includes/api/ApiMobileView.php
index 0c17505..cb375a0 100644
--- a/includes/api/ApiMobileView.php
+++ b/includes/api/ApiMobileView.php
@@ -87,6 +87,11 @@
                        );
                }
                $data = $this->getData( $title, $params['noimages'] );
+               // Bug 73109: #getData will return an empty array if the title 
redirects to
+               // a page in a virtual namespace (NS_SPECIAL, NS_MEDIA).
+               if ( !$data ) {
+                       $this->dieUsageMsg( array( 'notanarticle', 
$title->getPrefixedText() ) );
+               }
                if ( isset( $prop['lastmodified'] ) ) {
                        $this->getResult()->addValue( null, 
$this->getModuleName(),
                                array( 'lastmodified' => $data['lastmodified'] )

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3005453645daf205523c2640b6e5be77a91e6a69
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Phuedx <[email protected]>

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

Reply via email to