From c2a45c1238c63ad97dbbfd1ef29fb70a45a93d09 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Tue, 4 Nov 2014 17:17:29 +0100 Subject: throw exception if private key is missing --- lib/private/connector/sabre/file.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/private/connector/sabre/file.php b/lib/private/connector/sabre/file.php index 903c3447b56..dc036c1adca 100644 --- a/lib/private/connector/sabre/file.php +++ b/lib/private/connector/sabre/file.php @@ -100,6 +100,8 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements \Sabre\ } catch (\OCP\Files\LockNotAcquiredException $e) { // the file is currently being written to by another process throw new OC_Connector_Sabre_Exception_FileLocked($e->getMessage(), $e->getCode(), $e); + } catch (\OCA\Encryption\Exceptions\EncryptionException $e) { + throw new \Sabre\DAV\Exception\Forbidden($e->getMessage()); } // if content length is sent by client: @@ -152,7 +154,11 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements \Sabre\ if (\OC_Util::encryptedFiles()) { throw new \Sabre\DAV\Exception\ServiceUnavailable(); } else { - return $this->fileView->fopen(ltrim($this->path, '/'), 'rb'); + try { + return $this->fileView->fopen(ltrim($this->path, '/'), 'rb'); + } catch (\OCA\Encryption\Exceptions\EncryptionException $e) { + throw new \Sabre\DAV\Exception\Forbidden($e->getMessage()); + } } } -- cgit v1.2.3