]> 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>
Tue, 24 Sep 2013 11:54:18 +0000 (13:54 +0200)
lib/connector/sabre/file.php

index 61bdcd5e0ae297f37eeadf067f6667a99b524cd5..433b11485523f786851d20a9c8e9292f94379af3 100644 (file)
@@ -74,7 +74,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();