diff options
author | Jörn Friedrich Dreyer <jfd@butonic.de> | 2015-09-16 11:07:13 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-09-17 11:16:00 +0200 |
commit | 773941dfb021f7a29adb6076071155b3294a3465 (patch) | |
tree | d8ad03ef06e8eb2797a241d60c9dc6a58f25be18 | |
parent | c9397dffea9da757d18514e8eb303c3c88756c84 (diff) | |
download | nextcloud-server-773941dfb021f7a29adb6076071155b3294a3465.tar.gz nextcloud-server-773941dfb021f7a29adb6076071155b3294a3465.zip |
prevent 0 byte downloads when storage returns false
-rw-r--r-- | lib/private/connector/sabre/file.php | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/private/connector/sabre/file.php b/lib/private/connector/sabre/file.php index 17659c96b07..f4acc8290bc 100644 --- a/lib/private/connector/sabre/file.php +++ b/lib/private/connector/sabre/file.php @@ -261,10 +261,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()); |