]> source.dussan.org Git - nextcloud-server.git/commitdiff
duplicate code :sigh: - will fix this in a second pr
authorThomas Müller <thomas.mueller@tmit.eu>
Tue, 24 Sep 2013 11:54:18 +0000 (13:54 +0200)
committerThomas Müller <thomas.mueller@tmit.eu>
Wed, 2 Oct 2013 20:13:59 +0000 (22:13 +0200)
lib/connector/sabre/file.php

index 06ab73e3e4d11c95d9dd1e2f9958e3da24739e60..2ddf833f40e9caf1a1347a302c754587b5b77cfa 100644 (file)
@@ -69,7 +69,14 @@ class OC_Connector_Sabre_File extends OC_Connector_Sabre_Node implements Sabre_D
                }
 
                // rename to correct path
-               \OC\Files\Filesystem::rename($partpath, $this->path);
+               $renameOkay = \OC\Files\Filesystem::rename($partpath, $this->path);
+               $fileExists = \OC\Files\Filesystem::file_exists($this->path);
+               if ($renameOkay === false || $fileExists === false) {
+                       \OC_Log::write('webdav', '\OC\Files\Filesystem::rename() failed', \OC_Log::ERROR);
+                       \OC\Files\Filesystem::unlink($partpath);
+                       throw new Sabre_DAV_Exception();
+               }
+
 
                //allow sync clients to send the mtime along in a header
                $mtime = OC_Request::hasModificationTime();