]> source.dussan.org Git - nextcloud-server.git/commitdiff
if the file doesn't exists; create a new one. We use this to create new text files...
authorBjörn Schießle <schiessle@owncloud.com>
Fri, 12 Jul 2013 11:25:37 +0000 (13:25 +0200)
committerBjörn Schießle <schiessle@owncloud.com>
Mon, 22 Jul 2013 07:15:19 +0000 (09:15 +0200)
apps/files_external/lib/webdav.php

index c2fe7c67b582e994f65e60215d797590327665a0..4869322d87a9f9fcd78f21b24690ec7a46d3508e 100644 (file)
@@ -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) {