Ensure title in NS_FILE before showing archived file
authorKevin Israel <pleasestand@live.com>
Sun, 26 May 2013 01:27:56 +0000 (21:27 -0400)
committerKevin Israel <pleasestand@live.com>
Sun, 26 May 2013 01:27:56 +0000 (21:27 -0400)
Avoid an MWException "X is not a valid file title." with invalid
input such as index.php?title=Special:Undelete&title=X&file=Y .

Change-Id: Ie915726fdde8e772a63713d3eb9da232d9fd83bd

includes/specials/SpecialUndelete.php

index 9050724..c49c3eb 100644 (file)
@@ -760,7 +760,7 @@ class SpecialUndelete extends SpecialPage {
 
                if ( $this->mTimestamp !== '' ) {
                        $this->showRevision( $this->mTimestamp );
-               } elseif ( $this->mFilename !== null ) {
+               } elseif ( $this->mFilename !== null && $this->mTargetObj->inNamespace( NS_FILE ) ) {
                        $file = new ArchivedFile( $this->mTargetObj, '', $this->mFilename );
                        // Check if user is allowed to see this file
                        if ( !$file->exists() ) {