Skip to content

Commit 3b1b8e8

Browse files
author
Alejandro Pérez Batanero
committed
Encode CopySource parameter for rename in Aws
Update AwsS3Test.php
1 parent d17a2e3 commit 3b1b8e8

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/Gaufrette/Adapter/AwsS3.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public function rename($sourceKey, $targetKey)
134134
$this->ensureBucketExists();
135135
$options = $this->getOptions(
136136
$targetKey,
137-
['CopySource' => $this->bucket . '/' . $this->computePath($sourceKey)]
137+
['CopySource' => urlencode($this->bucket . '/' . $this->computePath($sourceKey))]
138138
);
139139

140140
try {

tests/Gaufrette/Functional/Adapter/AwsS3Test.php

+12
Original file line numberDiff line numberDiff line change
@@ -188,4 +188,16 @@ public function shouldUploadWithGivenContentType()
188188

189189
$this->assertEquals('text/html', $this->filesystem->mimeType('foo'));
190190
}
191+
192+
/**
193+
* @test
194+
*/
195+
public function shouldRenameAnObject()
196+
{
197+
$this->filesystem->write('foo', '');
198+
$this->filesystem->rename('foo', 'foo%_encode');
199+
200+
$this->assertFalse($this->filesystem->has('foo'));
201+
$this->assertTrue($this->filesystem->has('foo%_encode'));
202+
}
191203
}

0 commit comments

Comments
 (0)