X-Git-Url: https://git.cyclocoop.org/%28%28?a=blobdiff_plain;ds=sidebyside;f=img_auth.php;h=51470b6e6b2a232fd786af2b0a111bf02af61ed3;hb=0d41cd8729a37a9fd4e96685bccacce8b35d7cb0;hp=a3485dfd7e3a443dbfbdb4dffe0c757a26607576;hpb=de31b2474e29fe2f2eea6648b83d01ee53a726b7;p=lhc%2Fweb%2Fwiklou.git diff --git a/img_auth.php b/img_auth.php index a3485dfd7e..51470b6e6b 100644 --- a/img_auth.php +++ b/img_auth.php @@ -39,7 +39,6 @@ define( 'MW_NO_OUTPUT_COMPRESSION', 1 ); require __DIR__ . '/includes/WebStart.php'; -wfProfileIn( 'img_auth.php' ); # Set action base paths so that WebRequest::getPathInfo() # recognizes the "X" as the 'title' in ../img_auth.php/X urls. @@ -106,14 +105,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 );