From 7090509505a39651bb210eb2b16e25496f1245aa Mon Sep 17 00:00:00 2001 From: Jörn Friedrich Dreyer Date: Wed, 16 Sep 2015 11:07:13 +0200 Subject: prevent 0 byte downloads when storage returns false --- lib/private/connector/sabre/file.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/private/connector/sabre/file.php b/lib/private/connector/sabre/file.php index 06e5c5a3a26..59818272a37 100644 --- a/lib/private/connector/sabre/file.php +++ b/lib/private/connector/sabre/file.php @@ -249,10 +249,13 @@ class File extends Node implements IFile { * @throws ServiceUnavailable */ public function get() { - //throw exception if encryption is disabled but files are still encrypted try { - return $this->fileView->fopen(ltrim($this->path, '/'), 'rb'); + $res = $this->fileView->fopen(ltrim($this->path, '/'), 'rb'); + if ($res === false) { + throw new ServiceUnavailable("Could not open file"); + } + return $res; } catch (GenericEncryptionException $e) { // returning 503 will allow retry of the operation at a later point in time throw new ServiceUnavailable("Encryption not ready: " . $e->getMessage()); -- cgit v1.2.3