Aaron Schulz has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/106777


Change subject: Fixed temp URL breakage in Swift
......................................................................

Fixed temp URL breakage in Swift

* The API behavoir 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
---
M includes/filebackend/SwiftFileBackend.php
1 file changed, 3 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/77/106777/1

diff --git a/includes/filebackend/SwiftFileBackend.php 
b/includes/filebackend/SwiftFileBackend.php
index 91df61b..9ed6a45 100644
--- a/includes/filebackend/SwiftFileBackend.php
+++ b/includes/filebackend/SwiftFileBackend.php
@@ -1136,8 +1136,10 @@
 
                        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}";

-- 
To view, visit https://gerrit.wikimedia.org/r/106777
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3f0c80eed55991bb85d0c12f98927efa19af6760
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <asch...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to