* Mostly reverted r41081 and related. Although the motivation (to save a query) is...
[lhc/web/wiklou.git] / thumb.php
index 24bd3d2..b973cc6 100644 (file)
--- a/thumb.php
+++ b/thumb.php
@@ -55,7 +55,11 @@ function wfThumbMain() {
                        wfThumbError( 404, wfMsg( 'badtitletext' ) );
                        return;
                }
-               $title = Title::makeTitle( NS_IMAGE, $bits[1] );
+               $title = Title::makeTitleSafe( NS_FILE, $bits[1] );
+               if( is_null($title) ) {
+                       wfThumbError( 404, wfMsg( 'badtitletext' ) );
+                       return;
+               }
                $img = RepoGroup::singleton()->getLocalRepo()->newFromArchiveName( $title, $fileName );
        } else {
                $img = wfLocalFile( $fileName );