From: Bjoern Schiessle Date: Wed, 14 Aug 2013 07:44:29 +0000 (+0200) Subject: throw exception if encryption was disabled but files are still encrypted to prevent... X-Git-Tag: v6.0.0alpha2~292^2~4 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=6c3efaf26c397eb957081f1d7a3a05286ca8445f;p=nextcloud-server.git throw exception if encryption was disabled but files are still encrypted to prevent the client from syncing unreadable files --- diff --git a/lib/connector/sabre/file.php b/lib/connector/sabre/file.php index 06ab73e3e4d..61bdcd5e0ae 100644 --- a/lib/connector/sabre/file.php +++ b/lib/connector/sabre/file.php @@ -50,6 +50,11 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D throw new \Sabre_DAV_Exception_Forbidden(); } + // throw an exception if encryption was disabled but the files are still encrypted + if (\OC_Util::encryptedFiles()) { + throw new \Sabre_DAV_Exception_ServiceUnavailable(); + } + // mark file as partial while uploading (ignored by the scanner) $partpath = $this->path . '.part'; @@ -89,7 +94,12 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D */ public function get() { - return \OC\Files\Filesystem::fopen($this->path, 'rb'); + //throw execption if encryption is disabled but files are still encrypted + if (\OC_Util::encryptedFiles()) { + throw new \Sabre_DAV_Exception_ServiceUnavailable(); + } else { + return \OC\Files\Filesystem::fopen($this->path, 'rb'); + } }