Browse Source

Check delete permission before attemping copy+delete

Some move operations when cross-storage will be replaced by copy and
delete. Before attempting this, first check whether the source storage
has delete permissions.

This also prevents renaming system-wide external storages.
tags/v9.0.0RC1
Vincent Petry 8 years ago
parent
commit
a9e0cfad8b

+ 4
- 0
lib/private/files/storage/common.php View File

@@ -613,6 +613,10 @@ abstract class Common implements Storage, ILockingStorage {
return $this->rename($sourceInternalPath, $targetInternalPath);
}

if (!$sourceStorage->isDeletable($sourceInternalPath)) {
return false;
}

$result = $this->copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath, true);
if ($result) {
if ($sourceStorage->is_dir($sourceInternalPath)) {

+ 4
- 0
lib/private/files/storage/wrapper/encryption.php View File

@@ -459,6 +459,10 @@ class Encryption extends Wrapper {
// - copy the copyKeys() call from $this->copyBetweenStorage to this method
// - remove $this->copyBetweenStorage

if (!$sourceStorage->isDeletable($sourceInternalPath)) {
return false;
}

$result = $this->copyBetweenStorage($sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime, true);
if ($result) {
if ($sourceStorage->is_dir($sourceInternalPath)) {

Loading…
Cancel
Save