From 591d0be7587301dbc2d9f5c44d61da56be799238 Mon Sep 17 00:00:00 2001 From: David Wakelin Date: Tue, 8 Feb 2022 18:16:12 +0000 Subject: [PATCH] Public perms on file copy/move will now retain the current value --- SpacesAPI/File.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/SpacesAPI/File.php b/SpacesAPI/File.php index 789a9f0..59aa070 100644 --- a/SpacesAPI/File.php +++ b/SpacesAPI/File.php @@ -4,6 +4,8 @@ namespace SpacesAPI; use SpacesAPI\Exceptions\FileDoesntExistException; +use function PHPUnit\Framework\isNull; + /** * Represents a single file * @@ -211,14 +213,14 @@ class File * * @return \SpacesAPI\File */ - public function copy(string $newFilename, bool $public = false): File + public function copy(string $newFilename): File { $this->s3->copy( $this->space_name, $this->_filename, $this->space_name, $newFilename, - ($public) ? 'public-read' : 'private' + ($this->isPublic()) ? 'public-read' : 'private' ); return new self($this->space, $newFilename); @@ -231,7 +233,7 @@ class File */ public function move(string $newFilename): File { - $newFile = $this->copy($newFilename, $this->isPublic()); + $newFile = $this->copy($newFilename); $this->delete(); return $newFile;