From: Aaron Schulz Date: Fri, 10 Jan 2014 21:36:13 +0000 (-0800) Subject: Fixed temp URL breakage in Swift X-Git-Tag: 1.31.0-rc.0~17267 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=c00ab2af44e004865b020fb4fba799ae898032e2;p=lhc%2Fweb%2Fwiklou.git Fixed temp URL breakage in Swift * The API behavior is not well-documented in that it wants the HMAC to use the unencoded object name. CloudFiles had this same issue. bug: 59894 Change-Id: I3f0c80eed55991bb85d0c12f98927efa19af6760 --- diff --git a/includes/filebackend/SwiftFileBackend.php b/includes/filebackend/SwiftFileBackend.php index 91df61b82b..9ed6a4581f 100644 --- a/includes/filebackend/SwiftFileBackend.php +++ b/includes/filebackend/SwiftFileBackend.php @@ -1136,8 +1136,10 @@ class SwiftFileBackend extends FileBackendStore { if ( $this->swiftTempUrlKey != '' ) { $url = $this->storageUrl( $auth, $srcCont, $srcRel ); + // Swift wants the signature based on the unencoded object name + $contPath = parse_url( $this->storageUrl( $auth, $srcCont ), PHP_URL_PATH ); $signature = hash_hmac( 'sha1', - "GET\n{$expires}\n" . parse_url( $url, PHP_URL_PATH ), + "GET\n{$expires}\n{$contPath}/{$srcRel}", $this->swiftTempUrlKey ); return "{$url}?temp_url_sig={$signature}&temp_url_expires={$expires}";