Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'apps/dav/lib/connector/sabre/objecttree.php')
-rw-r--r--apps/dav/lib/connector/sabre/objecttree.php22
1 files changed, 18 insertions, 4 deletions
diff --git a/apps/dav/lib/connector/sabre/objecttree.php b/apps/dav/lib/connector/sabre/objecttree.php
index 24ce4acdf22..da17f1a268d 100644
--- a/apps/dav/lib/connector/sabre/objecttree.php
+++ b/apps/dav/lib/connector/sabre/objecttree.php
@@ -201,9 +201,18 @@ class ObjectTree extends \Sabre\DAV\Tree {
}
$infoDestination = $this->fileView->getFileInfo(dirname($destinationPath));
- $infoSource = $this->fileView->getFileInfo($sourcePath);
- $destinationPermission = $infoDestination && $infoDestination->isUpdateable();
- $sourcePermission = $infoSource && $infoSource->isDeletable();
+ if (dirname($destinationPath) === dirname($sourcePath)) {
+ $sourcePermission = $infoDestination && $infoDestination->isUpdateable();
+ $destinationPermission = $sourcePermission;
+ } else {
+ $infoSource = $this->fileView->getFileInfo($sourcePath);
+ if ($this->fileView->file_exists($destinationPath)) {
+ $destinationPermission = $infoDestination && $infoDestination->isUpdateable();
+ } else {
+ $destinationPermission = $infoDestination && $infoDestination->isCreatable();
+ }
+ $sourcePermission = $infoSource && $infoSource->isDeletable();
+ }
if (!$destinationPermission || !$sourcePermission) {
throw new Forbidden('No permissions to move object.');
@@ -292,7 +301,12 @@ class ObjectTree extends \Sabre\DAV\Tree {
}
$info = $this->fileView->getFileInfo(dirname($destination));
- if ($info && !$info->isUpdateable()) {
+ if ($this->fileView->file_exists($destination)) {
+ $destinationPermission = $info && $info->isUpdateable();
+ } else {
+ $destinationPermission = $info && $info->isCreatable();
+ }
+ if (!$destinationPermission) {
throw new Forbidden('No permissions to copy object.');
}