Skip to content

Commit

Permalink
Fix URL encoding for temporary URL signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
mzur committed Aug 30, 2021
1 parent f36c816 commit e03d7fc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/TempUrlSwiftAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ public function getTemporaryUrl($path, $expiration, $options)
$url = $this->getUrl($path);
$hmacPath = explode('v1', $url);
array_shift($hmacPath);
$hmacPath = implode('v1', $hmacPath);
// Decode URL for signature only as stated by the documentation.
$hmacPath = rawurldecode(implode('v1', $hmacPath));
$hmacBody = "GET\n{$expires}\n/v1{$hmacPath}";
$algo = Arr::get($options, 'algo', 'sha1');
$sig = hash_hmac($algo, $hmacBody, $this->tempUrlKey);
Expand Down

0 comments on commit e03d7fc

Please sign in to comment.