Warn about bug 44011
[lhc/web/wiklou.git] / img_auth.php
index a3485df..dcd171f 100644 (file)
@@ -47,6 +47,7 @@ $wgArticlePath = false; # Don't let a "/*" article path clober our action path
 $wgActionPaths = array( "$wgUploadPath/" );
 
 wfImageAuthMain();
+wfProfileOut( 'img_auth.php' );
 wfLogProfilingData();
 // Commit and close up!
 $factory = wfGetLBFactory();
@@ -106,14 +107,15 @@ function wfImageAuthMain() {
 
        // Get the local file repository
        $repo = RepoGroup::singleton()->getRepo( 'local' );
+       $zone = strstr( ltrim( $path, '/' ), '/', true );
 
        // Get the full file storage path and extract the source file name.
        // (e.g. 120px-Foo.png => Foo.png or page2-120px-Foo.png => Foo.png).
-       // This only applies to thumbnails, and all thumbnails should
+       // This only applies to thumbnails/transcoded, and each of them should
        // be under a folder that has the source file name.
-       if ( strpos( $path, '/thumb/' ) === 0 ) {
-               $name = wfBaseName( dirname( $path ) ); // file is a thumbnail
-               $filename = $repo->getZonePath( 'thumb' ) . substr( $path, 6 ); // strip "/thumb"
+       if ( $zone === 'thumb' || $zone === 'transcoded' ) {
+               $name = wfBaseName( dirname( $path ) );
+               $filename = $repo->getZonePath( $zone ) . substr( $path, strlen( "/" . $zone ) );
                // Check to see if the file exists
                if ( !$repo->fileExists( $filename ) ) {
                        wfForbidden( 'img-auth-accessdenied', 'img-auth-nofile', $filename );