Skip to content

Commit

Permalink
Encode CopySource parameter for rename in Aws
Browse files Browse the repository at this point in the history
Update AwsS3Test.php
  • Loading branch information
Alejandro Pérez Batanero committed Jan 7, 2020
1 parent d17a2e3 commit 3b1b8e8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Gaufrette/Adapter/AwsS3.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
12 changes: 12 additions & 0 deletions tests/Gaufrette/Functional/Adapter/AwsS3Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}
}

0 comments on commit 3b1b8e8

Please sign in to comment.