Skip to content
Snippets Groups Projects
Commit f39fcbc2 authored by Vincent Petry's avatar Vincent Petry
Browse files

Fixes WebDAV copy

- added existence check for source argument
- removed extra logic for folders, as $view->copy() already supports
  that internally
parent 14c592fe
No related branches found
No related tags found
No related merge requests found
......@@ -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());
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment