summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2016-01-05 13:44:14 +0100
committerMorris Jobke <hey@morrisjobke.de>2016-01-05 13:44:14 +0100
commit038351e0f73ffb9962b33caf6b062f815432769d (patch)
tree916f05b1893bf591a5f8a7498ee49d298bf088d0 /lib
parent073a00adb1f051fd17cb6eb2baa948446cb76cce (diff)
parent2c5234dcfe521c034190fd3babe54f1404266792 (diff)
downloadnextcloud-server-038351e0f73ffb9962b33caf6b062f815432769d.tar.gz
nextcloud-server-038351e0f73ffb9962b33caf6b062f815432769d.zip
Merge pull request #21296 from owncloud/stable8.1-prevent0bytedownloads
[stable8.1] prevent 0 byte downloads when storage returns false
Diffstat (limited to 'lib')
-rw-r--r--lib/private/connector/sabre/file.php7
1 files changed, 5 insertions, 2 deletions
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());