-if( !isset( $_SERVER['PATH_INFO'] ) )
- wfForbidden('img-auth-accessdenied','img-auth-nopathinfo');
+if( !isset( $_SERVER['PATH_INFO'] ) ) {
+ $path = $wgRequest->getText( 'path' );
+ if( !$path ) {
+ wfForbidden( 'img-auth-accessdenied', 'img-auth-nopathinfo' );
+ }
+ $path = "/$path";
+} else {
+ $path = $_SERVER['PATH_INFO'];
+}