From: Michael Gapczynski Date: Sun, 1 Apr 2012 06:38:26 +0000 (-0400) Subject: Check file handle exists before trying to read file X-Git-Tag: v4.0.0beta~381^2~19^2~11 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=6bb48b2731185dd93ad1a1edc52f33725cd99061;p=nextcloud-server.git Check file handle exists before trying to read file --- 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);