]> source.dussan.org Git - nextcloud-server.git/commitdiff
handle error situation of rename proper
authorThomas Müller <thomas.mueller@tmit.eu>
Mon, 23 Sep 2013 20:04:37 +0000 (22:04 +0200)
committerThomas Müller <thomas.mueller@tmit.eu>
Wed, 2 Oct 2013 20:13:58 +0000 (22:13 +0200)
lib/connector/sabre/directory.php

index 1434e970587a3101ab0523ae8a36a475afcdd463..b0d7102c6d960c39fc1af97a022aa01dc1a3ce1a 100644 (file)
@@ -88,7 +88,12 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa
                        }
 
                        // rename to correct path
-                       \OC\Files\Filesystem::rename($partpath, $newPath);
+                       $renameOkay = \OC\Files\Filesystem::rename($partpath, $newPath);
+                       if (!$renameOkay) {
+                               \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();