summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2015-04-08 16:41:20 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2015-04-08 16:41:20 +0200
commitc379557e1d56051d0258ede054961f282feaffcf (patch)
tree675dcee3fef4081c9af35d66274071e7d7339415 /lib
parentfc2711e15695f0be8e353a0237e5f1f5b5dc4389 (diff)
downloadnextcloud-server-c379557e1d56051d0258ede054961f282feaffcf.tar.gz
nextcloud-server-c379557e1d56051d0258ede054961f282feaffcf.zip
don't throw exception if a file gets uploaded and encryption is disabled
Diffstat (limited to 'lib')
-rw-r--r--lib/private/files/storage/wrapper/encryption.php11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/private/files/storage/wrapper/encryption.php b/lib/private/files/storage/wrapper/encryption.php
index e4f9781b382..4136e008af9 100644
--- a/lib/private/files/storage/wrapper/encryption.php
+++ b/lib/private/files/storage/wrapper/encryption.php
@@ -226,6 +226,7 @@ class Encryption extends Wrapper {
*/
public function fopen($path, $mode) {
+ $encryptionEnabled = $this->encryptionManager->isEnabled();
$shouldEncrypt = false;
$encryptionModule = null;
$header = $this->getHeader($path);
@@ -258,10 +259,11 @@ class Encryption extends Wrapper {
) {
if (!empty($encryptionModuleId)) {
$encryptionModule = $this->encryptionManager->getEncryptionModule($encryptionModuleId);
- } else {
+ $shouldEncrypt = $encryptionModule->shouldEncrypt($fullPath);
+ } elseif ($encryptionEnabled) {
$encryptionModule = $this->encryptionManager->getDefaultEncryptionModule();
+ $shouldEncrypt = $encryptionModule->shouldEncrypt($fullPath);
}
- $shouldEncrypt = $encryptionModule->shouldEncrypt($fullPath);
} else {
// only get encryption module if we found one in the header
if (!empty($encryptionModuleId)) {
@@ -271,12 +273,11 @@ class Encryption extends Wrapper {
}
} catch (ModuleDoesNotExistsException $e) {
$this->logger->warning('Encryption module "' . $encryptionModuleId .
- '" not found, file will be stored unencrypted');
+ '" not found, file will be stored unencrypted (' . $e->getMessage() . ')');
}
// encryption disabled on write of new file and write to existing unencrypted file -> don't encrypt
- $encEnabled = $this->encryptionManager->isEnabled();
- if (!$encEnabled || !$this->mount->getOption('encrypt', true)) {
+ if (!$encryptionEnabled || !$this->mount->getOption('encrypt', true)) {
if (!$targetExists || !$targetIsEncrypted) {
$shouldEncrypt = false;
}