Merge pull request #10121 from nextcloud/stable13-allow-disable-encryption

[stable13] allow to disable encryption
This commit is contained in:
Morris Jobke 2018-07-09 14:46:06 +02:00 committed by GitHub
commit 83d99449d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -414,9 +414,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