aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-07-09 13:39:57 +0200
committerGitHub <noreply@github.com>2018-07-09 13:39:57 +0200
commit103c8c373a8b2a3e99bc980870bb5a123568e972 (patch)
tree10f11c02920aae9f1a9188eb2c25b3a0a9fb8dff
parenta85dc8585b579a2d7b5e6da7225c7a6a6ef45926 (diff)
parent5d0fa12e1291addef1251fd2b1777f203fbf161b (diff)
downloadnextcloud-server-103c8c373a8b2a3e99bc980870bb5a123568e972.tar.gz
nextcloud-server-103c8c373a8b2a3e99bc980870bb5a123568e972.zip
Merge pull request #10120 from nextcloud/allow-to-disable-encryption
allow to disable encryption
-rw-r--r--lib/private/Files/Storage/Wrapper/Encryption.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/private/Files/Storage/Wrapper/Encryption.php b/lib/private/Files/Storage/Wrapper/Encryption.php
index 109de4c4e5c..42653b2d4a6 100644
--- a/lib/private/Files/Storage/Wrapper/Encryption.php
+++ b/lib/private/Files/Storage/Wrapper/Encryption.php
@@ -412,9 +412,13 @@ class Encryption extends Wrapper {
|| $mode === 'wb'
|| $mode === 'wb+'
) {
- // don't overwrite encrypted files if encryption is not enabled
+ // if we update a encrypted file with a un-encrypted one we change the db flag
if ($targetIsEncrypted && $encryptionEnabled === false) {
- throw new GenericEncryptionException('Tried to access encrypted file but encryption is not enabled');
+ $cache = $this->storage->getCache();
+ if ($cache) {
+ $entry = $cache->get($path);
+ $cache->update($entry->getId(), ['encrypted' => 0]);
+ }
}
if ($encryptionEnabled) {
// if $encryptionModuleId is empty, the default module will be used