From dd44e6eea4329d7545d37323b2ef3b41c291125c Mon Sep 17 00:00:00 2001 From: "Tais P. Hansen" Date: Wed, 22 May 2019 13:35:57 +0200 Subject: [PATCH] Fix server side copy of files with spaces in name Urlencode is not RFC 3986 compliant as it encodes spaces as plus (+) signs breaking S3 implementations that expect compliant encoding. Using rawurlencode instead fixes this. --- src/AwsS3Adapter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AwsS3Adapter.php b/src/AwsS3Adapter.php index e58c161..eddeceb 100644 --- a/src/AwsS3Adapter.php +++ b/src/AwsS3Adapter.php @@ -409,7 +409,7 @@ public function copy($path, $newpath) [ 'Bucket' => $this->bucket, 'Key' => $this->applyPathPrefix($newpath), - 'CopySource' => urlencode($this->bucket . '/' . $this->applyPathPrefix($path)), + 'CopySource' => rawurlencode($this->bucket . '/' . $this->applyPathPrefix($path)), 'ACL' => $this->getRawVisibility($path) === AdapterInterface::VISIBILITY_PUBLIC ? 'public-read' : 'private', ] + $this->options