-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
third-partyThis issue is related to third-party libraries or applications.This issue is related to third-party libraries or applications.
Description
Version of AWS SDK for PHP?
"aws/aws-sdk-php": "^3.105"
Version of PHP (php -v)?
PHP 7.0.33-0+deb9u3 (cli) (built: Mar 8 2019 10:01:24) ( NTS )
What issue did you see?
When the Key contains a symbol (In my case) like an @ (at) the functions returns an error (Exception).
root@debian:~/test2# php setPublic.php
PHP Fatal error: Uncaught exception 'Aws\S3\Exception\S3Exception' with message 'Error executing "PutObjectAcl" on "https://SPACE_NAME.fra1.digitaloceanspaces.com/%40acex/mod.cpp?acl"; AWS HTTP error: Client error: `PUT https://SPACE_NAME.fra1.digitaloceanspaces.com/%40acex/mod.cpp?acl` resulted in a `403 Forbidden` response:
<?xml version="1.0" encoding="UTF-8"?><Error><Code>SignatureDoesNotMatch</Code><RequestId>tx000000000000009ee57cd-005d26 (truncated...)
SignatureDoesNotMatch (client): - <?xml version="1.0" encoding="UTF-8"?><Error><Code>SignatureDoesNotMatch</Code><RequestId>tx000000000000009ee57cd-005d2636b1-1c0f65-fra1a</RequestId><HostId>1c0f65-fra1a-fra1</HostId></Error>'
GuzzleHttp\Exception\ClientException: Client error: `PUT https://SPACE_NAME.fra1.digitaloceanspaces.com/%40acex/mod.cpp?acl` resulted in a `403 Forbidden` response:
<?xml version="1.0" encoding="UTF-8"?><Error><Code>SignatureDoesNotMatch</Code><RequestId>tx000000000000009ee57cd-005d26 (truncated...)
in /root/test2/ven in /root/test2/vendor/aws/aws-sdk-php/src/WrappedHttpHandler.php on line 195
Steps to reproduce
<?php
require 'vendor/autoload.php';
use Aws\S3\S3Client;
$key = "PRIVATE_KEY";
$secret = "PRIVATE_SECRET";
$space = "SPACE_NAME";
$region = "REGION";
$host = "digitaloceanspaces.com";
$endpoint = "https://".$space.".".$region.".".$host;
$client = Aws\S3\S3Client::factory(array(
'region' => $region,
'version' => 'latest',
'endpoint' => $endpoint,
'credentials' => array(
'key' => $key,
'secret' => $secret,
),
'bucket_endpoint' => true,
'signature_version' => 'v4-unsigned-body'
));
$aclHeader = ["ACL" => "public-read"];
$acl = array_merge(array("Bucket" => $space, "Key" => '@acex/mod.cpp'), $aclHeader);
$client->putObjectAcl($acl);Additional context
I used the endpoint of Digitalocean Spaces, which shouldn't make any difference, but just in case.
Metadata
Metadata
Assignees
Labels
third-partyThis issue is related to third-party libraries or applications.This issue is related to third-party libraries or applications.