From 36c31b0e83dafa0499a769fa6c15adeca5e90d28 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Fri, 23 Sep 2011 17:32:14 +0200 Subject: [PATCH] fix warning when uploading file using webdav When uploading a file using davfs php warned about a missing argument to OC_FileProxy_Quota::preFile_put_contents(). Since we get a resource from OC_Connector_Sabre_File->put(), we have to convert that before running strlen because it expects a string. Signed-off-by: Florian Pritz --- lib/fileproxy/quota.php | 3 +++ lib/filesystem.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/fileproxy/quota.php b/lib/fileproxy/quota.php index af8ddee1473..fe3a2333428 100644 --- a/lib/fileproxy/quota.php +++ b/lib/fileproxy/quota.php @@ -44,6 +44,9 @@ class OC_FileProxy_Quota extends OC_FileProxy{ } public function preFile_put_contents($path,$data){ + if (is_resource($data)) { + $data = stream_get_contents($data); + } return (strlen($data)<$this->getFreeSpace() or $this->getFreeSpace()==0); } diff --git a/lib/filesystem.php b/lib/filesystem.php index f242a1b158e..d7c485d25b8 100644 --- a/lib/filesystem.php +++ b/lib/filesystem.php @@ -454,7 +454,7 @@ class OC_Filesystem{ * @return mixed */ private static function basicOperation($operation,$path,$hooks=array(),$extraParam=null){ - if(OC_FileProxy::runPreProxies($operation,$path) and self::canRead($path) and $storage=self::getStorage($path)){ + if(OC_FileProxy::runPreProxies($operation,$path, $extraParam) and self::canRead($path) and $storage=self::getStorage($path)){ $interalPath=self::getInternalPath($path); $run=true; foreach($hooks as $hook){ -- 2.39.5