From 9afe6fb69c653a5465eb4e82ebdc0427b95074de Mon Sep 17 00:00:00 2001 From: Pranav Kant Date: Thu, 25 May 2017 17:07:21 +0530 Subject: [PATCH] Guard encryption support (cherry picked from commit c14ff8fee8b3a64212aed0de0aa832581edb6e8d) Signed-off-by: Andras Timar --- lib/Controller/DocumentController.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/Controller/DocumentController.php b/lib/Controller/DocumentController.php index 1bd3e615..2637b0b4 100644 --- a/lib/Controller/DocumentController.php +++ b/lib/Controller/DocumentController.php @@ -111,12 +111,16 @@ class DocumentController extends Controller { 'instanceId' => $this->settings->getSystemValue('instanceid'), ]; - // Update the current file to be accessible with system public shared key - $owner = $item->getOwner()->getUID(); - $absPath = '/' . $owner . '/' . $item->getInternalPath(); - $accessList = \OC::$server->getEncryptionFilesHelper()->getAccessList($absPath); - $accessList['public'] = true; - \OC::$server->getEncryptionManager()->getEncryptionModule()->update($absPath, $owner, $accessList); + $encryptionManager = \OC::$server->getEncryptionManager(); + if ($encryptionManager->isEnabled()) + { + // Update the current file to be accessible with system public shared key + $owner = $item->getOwner()->getUID(); + $absPath = '/' . $owner . '/' . $item->getInternalPath(); + $accessList = \OC::$server->getEncryptionFilesHelper()->getAccessList($absPath); + $accessList['public'] = true; + $encryptionManager->getEncryptionModule()->update($absPath, $owner, $accessList); + } $response = new TemplateResponse('richdocuments', 'documents', $params, 'empty'); $policy = new ContentSecurityPolicy();