summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/private/Share20/Manager.php9
-rw-r--r--tests/lib/Share20/ManagerTest.php3
2 files changed, 8 insertions, 4 deletions
diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php
index 6e59629153e..3afd38c579f 100644
--- a/lib/private/Share20/Manager.php
+++ b/lib/private/Share20/Manager.php
@@ -1233,7 +1233,7 @@ class Manager implements IManager {
//Get node for the owner
$userFolder = $this->rootFolder->getUserFolder($owner);
- if (!$userFolder->isSubNode($path)) {
+ if ($path->getId() !== $userFolder->getId() && !$userFolder->isSubNode($path)) {
$path = $userFolder->getById($path->getId())[0];
}
@@ -1245,7 +1245,12 @@ class Manager implements IManager {
if ($currentAccess) {
$ownerPath = $path->getPath();
- list(, , , $ownerPath) = explode('/', $ownerPath, 4);
+ $ownerPath = explode('/', $ownerPath, 4);
+ if (count($ownerPath) < 4) {
+ $ownerPath = '';
+ } else {
+ $ownerPath = $ownerPath[3];
+ }
$al['users'][$owner] = [
'node_id' => $path->getId(),
'node_path' => '/' . $ownerPath,
diff --git a/tests/lib/Share20/ManagerTest.php b/tests/lib/Share20/ManagerTest.php
index 42308a9d6a6..7de73421d3e 100644
--- a/tests/lib/Share20/ManagerTest.php
+++ b/tests/lib/Share20/ManagerTest.php
@@ -2767,8 +2767,7 @@ class ManagerTest extends \Test\TestCase {
$node->expects($this->once())
->method('getOwner')
->willReturn($owner);
- $node->expects($this->once())
- ->method('getId')
+ $node->method('getId')
->willReturn(42);
$userFolder = $this->createMock(Folder::class);