diff options
author | Michael Gapczynski <GapczynskiM@gmail.com> | 2012-04-01 02:38:26 -0400 |
---|---|---|
committer | Michael Gapczynski <GapczynskiM@gmail.com> | 2012-04-01 02:38:26 -0400 |
commit | 6bb48b2731185dd93ad1a1edc52f33725cd99061 (patch) | |
tree | 0546c5b8ad5bb692649a75e1d2db188db70c6d39 /lib/filesystemview.php | |
parent | daf742c086fefab9d715be3308088e626de1216c (diff) | |
download | nextcloud-server-6bb48b2731185dd93ad1a1edc52f33725cd99061.tar.gz nextcloud-server-6bb48b2731185dd93ad1a1edc52f33725cd99061.zip |
Check file handle exists before trying to read file
Diffstat (limited to 'lib/filesystemview.php')
-rw-r--r-- | lib/filesystemview.php | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/filesystemview.php b/lib/filesystemview.php index 39e47975b28..a3736f1976c 100644 --- a/lib/filesystemview.php +++ b/lib/filesystemview.php @@ -137,13 +137,16 @@ class OC_FilesystemView { } public function readfile($path){ $handle=$this->fopen($path,'r'); - $chunkSize = 1024*1024;// 1 MB chunks - while (!feof($handle)) { - echo fread($handle, $chunkSize); - @ob_flush(); - flush(); + if ($handle) { + $chunkSize = 1024*1024;// 1 MB chunks + while (!feof($handle)) { + echo fread($handle, $chunkSize); + @ob_flush(); + flush(); + } + return $this->filesize($path); } - return $this->filesize($path); + return false; } public function is_readable($path){ return $this->basicOperation('is_readable',$path); |