Skip to content

Commit

Permalink
Make same path copy/move a no-op for AWS S3
Browse files Browse the repository at this point in the history
  • Loading branch information
frankdejonge committed Aug 17, 2024
1 parent 2c8083f commit 22af5a3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/AsyncAwsS3/AsyncAwsS3Adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,10 @@ public function listContents(string $path, bool $deep): iterable

public function move(string $source, string $destination, Config $config): void
{
if ($source === $destination) {
return;
}

try {
$this->copy($source, $destination, $config);
$this->delete($source);
Expand All @@ -317,8 +321,11 @@ public function move(string $source, string $destination, Config $config): void

public function copy(string $source, string $destination, Config $config): void
{
try {
if ($source === $destination) {
return;
}

try {
$visibility = $config->get(Config::OPTION_VISIBILITY);

if ($visibility === null && $config->get(Config::OPTION_RETAIN_VISIBILITY, true)) {
Expand Down
8 changes: 8 additions & 0 deletions src/AwsS3V3/AwsS3V3Adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,10 @@ private function retrievePaginatedListing(array $options): Generator

public function move(string $source, string $destination, Config $config): void
{
if ($source === $destination) {
return;
}

try {
$this->copy($source, $destination, $config);
$this->delete($source);
Expand All @@ -417,6 +421,10 @@ public function move(string $source, string $destination, Config $config): void

public function copy(string $source, string $destination, Config $config): void
{
if ($source === $destination) {
return;
}

try {
$visibility = $config->get(Config::OPTION_VISIBILITY);

Expand Down
2 changes: 1 addition & 1 deletion src/AwsS3V3/AwsS3V3AdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ protected function tearDown(): void

protected function setUp(): void
{
if (PHP_VERSION_ID < 801000) {
if (PHP_VERSION_ID < 80100) {
$this->markTestSkipped('AWS does not support this anymore.');
}

Expand Down

0 comments on commit 22af5a3

Please sign in to comment.