Skip to content

Commit

Permalink
Allow copy without retaining visibility for adapters and implementati…
Browse files Browse the repository at this point in the history
…ons that required fetching visibility for copy and move.
  • Loading branch information
frankdejonge committed Nov 2, 2023
1 parent ded9ba3 commit 309da4c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions AwsS3V3Adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -415,8 +415,11 @@ public function move(string $source, string $destination, Config $config): void
public function copy(string $source, string $destination, Config $config): void
{
try {
/** @var string $visibility */
$visibility = $config->get(Config::OPTION_VISIBILITY) ?: $this->visibility($source)->visibility();
$visibility = $config->get(Config::OPTION_VISIBILITY);

if ($visibility === null && $config->get('retain_visibility', true)) {
$visibility = $this->visibility($source)->visibility();
}
} catch (Throwable $exception) {
throw UnableToCopyFile::fromLocationTo(
$source,
Expand All @@ -431,7 +434,7 @@ public function copy(string $source, string $destination, Config $config): void
$this->prefixer->prefixPath($source),
$this->bucket,
$this->prefixer->prefixPath($destination),
$this->visibility->visibilityToAcl($visibility),
$this->visibility->visibilityToAcl($visibility ?: 'private'),
$this->createOptionsFromConfig($config)['params']
);
} catch (Throwable $exception) {
Expand Down

0 comments on commit 309da4c

Please sign in to comment.