mirror of
https://github.com/SociallyDev/Spaces-API.git
synced 2025-08-20 13:23:47 -07:00
Public perms on file copy/move will now retain the current value
This commit is contained in:
parent
6b438e0b9a
commit
591d0be758
1 changed files with 5 additions and 3 deletions
|
@ -4,6 +4,8 @@ namespace SpacesAPI;
|
||||||
|
|
||||||
use SpacesAPI\Exceptions\FileDoesntExistException;
|
use SpacesAPI\Exceptions\FileDoesntExistException;
|
||||||
|
|
||||||
|
use function PHPUnit\Framework\isNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a single file
|
* Represents a single file
|
||||||
*
|
*
|
||||||
|
@ -211,14 +213,14 @@ class File
|
||||||
*
|
*
|
||||||
* @return \SpacesAPI\File
|
* @return \SpacesAPI\File
|
||||||
*/
|
*/
|
||||||
public function copy(string $newFilename, bool $public = false): File
|
public function copy(string $newFilename): File
|
||||||
{
|
{
|
||||||
$this->s3->copy(
|
$this->s3->copy(
|
||||||
$this->space_name,
|
$this->space_name,
|
||||||
$this->_filename,
|
$this->_filename,
|
||||||
$this->space_name,
|
$this->space_name,
|
||||||
$newFilename,
|
$newFilename,
|
||||||
($public) ? 'public-read' : 'private'
|
($this->isPublic()) ? 'public-read' : 'private'
|
||||||
);
|
);
|
||||||
|
|
||||||
return new self($this->space, $newFilename);
|
return new self($this->space, $newFilename);
|
||||||
|
@ -231,7 +233,7 @@ class File
|
||||||
*/
|
*/
|
||||||
public function move(string $newFilename): File
|
public function move(string $newFilename): File
|
||||||
{
|
{
|
||||||
$newFile = $this->copy($newFilename, $this->isPublic());
|
$newFile = $this->copy($newFilename);
|
||||||
$this->delete();
|
$this->delete();
|
||||||
|
|
||||||
return $newFile;
|
return $newFile;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue