diff --git a/src/Gaufrette/Adapter/AwsS3.php b/src/Gaufrette/Adapter/AwsS3.php index 2f68ec19d..5a10f1168 100644 --- a/src/Gaufrette/Adapter/AwsS3.php +++ b/src/Gaufrette/Adapter/AwsS3.php @@ -134,7 +134,7 @@ public function rename($sourceKey, $targetKey) $this->ensureBucketExists(); $options = $this->getOptions( $targetKey, - ['CopySource' => $this->bucket . '/' . $this->computePath($sourceKey)] + ['CopySource' => urlencode($this->bucket . '/' . $this->computePath($sourceKey))] ); try { diff --git a/tests/Gaufrette/Functional/Adapter/AwsS3Test.php b/tests/Gaufrette/Functional/Adapter/AwsS3Test.php index 1a786f4a3..47f90d467 100644 --- a/tests/Gaufrette/Functional/Adapter/AwsS3Test.php +++ b/tests/Gaufrette/Functional/Adapter/AwsS3Test.php @@ -188,4 +188,16 @@ public function shouldUploadWithGivenContentType() $this->assertEquals('text/html', $this->filesystem->mimeType('foo')); } + + /** + * @test + */ + public function shouldRenameAnObject() + { + $this->filesystem->write('foo', ''); + $this->filesystem->rename('foo', 'foo%_encode'); + + $this->assertFalse($this->filesystem->has('foo')); + $this->assertTrue($this->filesystem->has('foo%_encode')); + } }