From: Gergő Tisza Date: Sat, 26 Aug 2017 00:32:15 +0000 (+0000) Subject: Fix RestbaseVirtualRESTService URL standardization X-Git-Tag: 1.31.0-rc.0~2218^2 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=a3c61d717e346e5e848adc6914cd62f7126badea Fix RestbaseVirtualRESTService URL standardization The regex /?$ will add a second slash to URLs which already end in a slash (since it will match both the trailing slash and the empty position after it), which is enough to trip up HyperSwitch. Change-Id: I675f8252a2496ace4d6c364a869776dff604df59 --- diff --git a/includes/libs/virtualrest/RestbaseVirtualRESTService.php b/includes/libs/virtualrest/RestbaseVirtualRESTService.php index 35c45deb50..90865ffcf1 100644 --- a/includes/libs/virtualrest/RestbaseVirtualRESTService.php +++ b/includes/libs/virtualrest/RestbaseVirtualRESTService.php @@ -61,11 +61,9 @@ class RestbaseVirtualRESTService extends VirtualRESTService { 'fixedUrl' => false, ], $params ); // Ensure that the url parameter has a trailing slash. - $mparams['url'] = preg_replace( - '#/?$#', - '/', - $mparams['url'] - ); + if ( substr( $mparams['url'], -1 ) !== '/' ) { + $mparams['url'] .= '/'; + } // Ensure the correct domain format: strip protocol, port, // and trailing slash if present. This lets us use // $wgCanonicalServer as a default value, which is very convenient.