From: Ian Baker Date: Tue, 13 Sep 2011 00:53:30 +0000 (+0000) Subject: If the scaler URL is protocol-relative, things just break here. Sets a sane default. X-Git-Tag: 1.31.0-rc.0~27703 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=commitdiff_plain;h=7d3c428599b3b004848924b1b0a22d55b57500b8;p=lhc%2Fweb%2Fwiklou.git If the scaler URL is protocol-relative, things just break here. Sets a sane default. --- diff --git a/includes/specials/SpecialUploadStash.php b/includes/specials/SpecialUploadStash.php index 3be2e816bd..ba818efea0 100644 --- a/includes/specials/SpecialUploadStash.php +++ b/includes/specials/SpecialUploadStash.php @@ -210,12 +210,20 @@ class SpecialUploadStash extends UnlistedSpecialPage { // this global probably looks something like 'http://upload.wikimedia.org/wikipedia/test/thumb/temp' // do not use trailing slash global $wgUploadStashScalerBaseUrl; + $scalerBaseUrl = $wgUploadStashScalerBaseUrl; + + if( preg_match( '/^\/\//', $scalerBaseUrl ) ) { + // this is apparently a protocol-relative URL, which makes no sense in this context, + // since this is used for communication that's internal to the application. + // default to http. + $scalerBaseUrl = 'http:' . $scalerBaseUrl; + } // We need to use generateThumbName() instead of thumbName(), because // the suffix needs to match the file name for the remote thumbnailer // to work $scalerThumbName = $file->generateThumbName( $file->getName(), $params ); - $scalerThumbUrl = $wgUploadStashScalerBaseUrl . '/' . $file->getUrlRel() . + $scalerThumbUrl = $scalerBaseUrl . '/' . $file->getUrlRel() . '/' . rawurlencode( $scalerThumbName ); // make a curl call to the scaler to create a thumbnail