X-Git-Url: https://reisub.nsupdate.info/git/?p=friendica-addons.git%2F.git;a=blobdiff_plain;f=s3_storage%2Fvendor%2Fakeeba%2Fs3%2Fsrc%2FSignature%2FV2.php;fp=s3_storage%2Fvendor%2Fakeeba%2Fs3%2Fsrc%2FSignature%2FV2.php;h=ef7e7daad0a81c0979124705626422b1ece2ae6e;hp=6864846fa88ce91e88d41c716141ea001e9ba9c5;hb=e0165b39bd9f1a105f28e17e75656ce88c5139ba;hpb=efdbab5100af7b5809ddc72319c32f3799adf1fa diff --git a/s3_storage/vendor/akeeba/s3/src/Signature/V2.php b/s3_storage/vendor/akeeba/s3/src/Signature/V2.php index 6864846f..ef7e7daa 100644 --- a/s3_storage/vendor/akeeba/s3/src/Signature/V2.php +++ b/s3_storage/vendor/akeeba/s3/src/Signature/V2.php @@ -3,7 +3,7 @@ * Akeeba Engine * * @package akeebaengine - * @copyright Copyright (c)2006-2023 Nicholas K. Dionysopoulos / Akeeba Ltd + * @copyright Copyright (c)2006-2024 Nicholas K. Dionysopoulos / Akeeba Ltd * @license GNU General Public License version 3, or later */ @@ -64,10 +64,11 @@ class V2 extends Signature $search = '/' . $bucket; - if (strpos($uri, $search) === 0) - { - $uri = substr($uri, strlen($search)); - } + // This does not look right... The bucket name must be included in the URL. +// if (strpos($uri, $search) === 0) +// { +// $uri = substr($uri, strlen($search)); +// } $queryParameters = array_merge($this->request->getParameters(), [ 'AWSAccessKeyId' => $accessKey, @@ -134,7 +135,15 @@ class V2 extends Signature // See http://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html#RESTAuthenticationQueryStringAuth if (isset($headers['Expires'])) { - $headers['Date'] = $headers['Expires']; + if (isset($headers['Date'])) + { + $headers['Date'] = $headers['Expires']; + } + else + { + $amzHeaders['x-amz-date'] = $headers['Expires']; + } + unset ($headers['Expires']); $isPresignedURL = true; @@ -152,14 +161,14 @@ class V2 extends Signature $stringToSign = $verb . "\n" . ($headers['Content-MD5'] ?? '') . "\n" . ($headers['Content-Type'] ?? '') . "\n" . - $headers['Date'] . + ($headers['Date'] ?? '') . $amzString . "\n" . $resourcePath; // CloudFront only requires a date to be signed if ($headers['Host'] == 'cloudfront.amazonaws.com') { - $stringToSign = $headers['Date']; + $stringToSign = $headers['Date'] ?? $amzHeaders['x-amz-date'] ?? ''; } $amazonV2Hash = $this->amazonV2Hash($stringToSign);