From c00ab2af44e004865b020fb4fba799ae898032e2 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Fri, 10 Jan 2014 13:36:13 -0800 Subject: [PATCH] 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 --- includes/filebackend/SwiftFileBackend.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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}"; -- 2.20.1