Fix exception when searching for stuff beginning with "Media:"
authorMax Semenik <maxsem.wiki@gmail.com>
Thu, 22 Nov 2012 00:29:49 +0000 (04:29 +0400)
committerMax Semenik <maxsem.wiki@gmail.com>
Thu, 22 Nov 2012 00:29:49 +0000 (04:29 +0400)
Change-Id: I8b5a419fa369ad91034c3769a4b228290b878e1b

includes/search/SearchEngine.php

index ec542a6..fa7b872 100644 (file)
@@ -187,6 +187,11 @@ class SearchEngine {
                                return null;
                        }
 
+                       # Try files if searching in the Media: namespace
+                       if ( $title->getNamespace() == NS_MEDIA ) {
+                               $title = Title::makeTitle( NS_FILE, $title->getText() );
+                       }
+
                        if ( $title->isSpecialPage() || $title->isExternal() || $title->exists() ) {
                                return $title;
                        }