Problem:
Files uploaded via roundcube and via save to cloud are created but have the size of 0 bytes.
The code seems incomplete since a filehandle actually is a handle not a variable.
So line 334 will cause a SabreDav Exception which isn't handled right now.
My fix works when reading the handle and putting it into a variable:
--- webdav_file_storage.php 2017-11-23 14:05:00.000000000 +0100 +++ webdav_file_storage.php.new 2017-11-23 14:08:15.696683098 +0100 @@ -334,7 +334,12 @@ $this->init(); if ($file['path']) { - $data = fopen($file['path'], 'r'); + $myfile = fopen($file['path'], 'r'); + if ( $myfile === false ) { + throw new Exception("Storage error. Cannot open temporary file " . $file['path'], file_storage::ERROR); + } + $data = fread($myfile,filesize($file['path'])); + fclose($myfile); } else { // Resource or data @@ -362,7 +367,12 @@ $this->init(); if ($file['path']) { - $data = fopen($file['path'], 'r'); + $myfile = fopen($file['path'], 'r'); + if ( $myfile === false ) { + throw new Exception("Storage error. Cannot open temporary file " . $file['path'], file_storage::ERROR); + } + $data = fread($myfile,filesize($file['path'])); + fclose($myfile); } else { //Resource or data
Tested it and of course it works ;-)
Best regards
Franz