]> 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>
Mon, 23 Sep 2013 20:04:37 +0000 (22:04 +0200)
lib/connector/sabre/directory.php

index 3181a4b310f06515a1504ff14708f16c1c6fcbb2..9e0fe5e64e73224a10601df1a5342f9e90ba86d1 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();