diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2015-04-27 11:40:10 +0200 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2015-05-06 11:35:45 +0200 |
commit | e7a3911c83806f0a11ebf00b96d7498815d718be (patch) | |
tree | 860d5588dca6ed8e79a4fb8502686a95cb39bc5b /lib/private/files/storage/wrapper | |
parent | 9a159372cb31b9fe4616e5403773eb078c5ad828 (diff) | |
download | nextcloud-server-e7a3911c83806f0a11ebf00b96d7498815d718be.tar.gz nextcloud-server-e7a3911c83806f0a11ebf00b96d7498815d718be.zip |
check if encryption is enbaled before we start moving keys
Diffstat (limited to 'lib/private/files/storage/wrapper')
-rw-r--r-- | lib/private/files/storage/wrapper/encryption.php | 53 |
1 files changed, 29 insertions, 24 deletions
diff --git a/lib/private/files/storage/wrapper/encryption.php b/lib/private/files/storage/wrapper/encryption.php index 439dc0ab6d3..30ef509f91a 100644 --- a/lib/private/files/storage/wrapper/encryption.php +++ b/lib/private/files/storage/wrapper/encryption.php @@ -220,23 +220,23 @@ class Encryption extends Wrapper { * @return bool */ public function rename($path1, $path2) { - $source = $this->getFullPath($path1); - if ($this->util->isExcluded($source)) { - return $this->storage->rename($path1, $path2); - } $result = $this->storage->rename($path1, $path2); - if ($result) { - $target = $this->getFullPath($path2); - if (isset($this->unencryptedSize[$source])) { - $this->unencryptedSize[$target] = $this->unencryptedSize[$source]; - } - $keysRenamed = $this->keyStorage->renameKeys($source, $target); - if ($keysRenamed && - dirname($source) !== dirname($target) && - $this->util->isFile($target) - ) { - $this->update->update($target); + + if ($result && $this->encryptionManager->isEnabled()) { + $source = $this->getFullPath($path1); + if (!$this->util->isExcluded($source)) { + $target = $this->getFullPath($path2); + if (isset($this->unencryptedSize[$source])) { + $this->unencryptedSize[$target] = $this->unencryptedSize[$source]; + } + $keysRenamed = $this->keyStorage->renameKeys($source, $target); + if ($keysRenamed && + dirname($source) !== dirname($target) && + $this->util->isFile($target) + ) { + $this->update->update($target); + } } } @@ -251,22 +251,27 @@ class Encryption extends Wrapper { * @return bool */ public function copy($path1, $path2) { + $fullPath1 = $this->getFullPath($path1); $fullPath2 = $this->getFullPath($path2); + if ($this->util->isExcluded($fullPath1)) { return $this->storage->copy($path1, $path2); } - $source = $this->getFullPath($path1); $result = $this->storage->copy($path1, $path2); - if ($result) { - $target = $this->getFullPath($path2); - $keysCopied = $this->keyStorage->copyKeys($source, $target); - if ($keysCopied && - dirname($source) !== dirname($target) && - $this->util->isFile($target) - ) { - $this->update->update($target); + + if ($result && $this->encryptionManager->isEnabled()) { + $source = $this->getFullPath($path1); + if (!$this->util->isExcluded($source)) { + $target = $this->getFullPath($path2); + $keysCopied = $this->keyStorage->copyKeys($source, $target); + if ($keysCopied && + dirname($source) !== dirname($target) && + $this->util->isFile($target) + ) { + $this->update->update($target); + } } $data = $this->getMetaData($path1); $this->getCache()->put($path2, ['encrypted' => $data['encrypted']]); |