]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fixes WebDAV copy
authorVincent Petry <pvince81@owncloud.com>
Wed, 25 Feb 2015 15:35:13 +0000 (16:35 +0100)
committerVincent Petry <pvince81@owncloud.com>
Wed, 25 Feb 2015 15:35:13 +0000 (16:35 +0100)
- added existence check for source argument
- removed extra logic for folders, as $view->copy() already supports
  that internally

lib/private/connector/sabre/objecttree.php

index 585be637813e1dc2be5a821405c5c090305a5c57..e13d4ded91befc09ec0dc4fcd79a71150be22ba6 100644 (file)
@@ -234,21 +234,11 @@ class ObjectTree extends \Sabre\DAV\Tree {
                        throw new \Sabre\DAV\Exception\ServiceUnavailable('filesystem not setup');
                }
 
-               try {
-                       if ($this->fileView->is_file($source)) {
-                               $this->fileView->copy($source, $destination);
-                       } else {
-                               $this->fileView->mkdir($destination);
-                               $dh = $this->fileView->opendir($source);
-                               if (is_resource($dh)) {
-                                       while (($subNode = readdir($dh)) !== false) {
-
-                                               if ($subNode == '.' || $subNode == '..') continue;
-                                               $this->copy($source . '/' . $subNode, $destination . '/' . $subNode);
+               // this will trigger existence check
+               $node = $this->getNodeForPath($source);
 
-                                       }
-                               }
-                       }
+               try {
+                       $this->fileView->copy($source, $destination);
                } catch (\OCP\Files\StorageNotAvailableException $e) {
                        throw new \Sabre\DAV\Exception\ServiceUnavailable($e->getMessage());
                }