From: Björn Schießle Date: Fri, 12 Jul 2013 11:25:37 +0000 (+0200) Subject: if the file doesn't exists; create a new one. We use this to create new text files... X-Git-Tag: v6.0.0alpha2~427 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=da892d69ab724354e1b3ee251e540ba306fffe44;p=nextcloud-server.git if the file doesn't exists; create a new one. We use this to create new text files in the web interface --- diff --git a/apps/files_external/lib/webdav.php b/apps/files_external/lib/webdav.php index c2fe7c67b58..4869322d87a 100644 --- a/apps/files_external/lib/webdav.php +++ b/apps/files_external/lib/webdav.php @@ -234,7 +234,13 @@ class DAV extends \OC\Files\Storage\Common{ $mtime=time(); } $path=$this->cleanPath($path); - $this->client->proppatch($path, array('{DAV:}lastmodified' => $mtime)); + + // if file exists, update the mtime, else create a new empty file + if ($this->file_exists($path)) { + $this->client->proppatch($path, array('{DAV:}lastmodified' => $mtime)); + } else { + $this->file_put_contents($path, ''); + } } public function getFile($path, $target) {