diff options
author | Robin Appelman <robin@icewind.nl> | 2015-09-21 13:50:35 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2015-09-21 13:50:35 +0200 |
commit | b520a1e5203763adfa354428d2cd924ee7ee86e5 (patch) | |
tree | 2b4bd55789c8fcda22a955bb9883eb54ed2e8c28 /lib/private/connector | |
parent | 2762f29acf4e3f8ec7a10861dcfa903195d64e4f (diff) | |
parent | 2839ef34395599adf060a485a263a69ce27305e1 (diff) | |
download | nextcloud-server-b520a1e5203763adfa354428d2cd924ee7ee86e5.tar.gz nextcloud-server-b520a1e5203763adfa354428d2cd924ee7ee86e5.zip |
Merge pull request #19081 from owncloud/prevent0bytedownloads
prevent 0 byte downloads when storage returns false
Diffstat (limited to 'lib/private/connector')
-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()); |