diff --git a/lib/private/Files/Node/Folder.php b/lib/private/Files/Node/Folder.php index 90aed642a2d19..f05a470caa676 100644 --- a/lib/private/Files/Node/Folder.php +++ b/lib/private/Files/Node/Folder.php @@ -102,7 +102,7 @@ public function getDirectoryListing() { return array_map(function (FileInfo $info) { if ($info->getMimetype() === FileInfo::MIMETYPE_FOLDER) { - return new Folder($this->root, $this->view, $info->getPath(), $info, $this); + return new Folder($this->root, $this->view, $this->view->getRelativePath($info->getPath()), $info, $this); } else { return new File($this->root, $this->view, $info->getPath(), $info, $this); } diff --git a/tests/lib/Files/Node/FolderTest.php b/tests/lib/Files/Node/FolderTest.php index 8a604af384695..d2c8fa98b2f02 100644 --- a/tests/lib/Files/Node/FolderTest.php +++ b/tests/lib/Files/Node/FolderTest.php @@ -79,6 +79,10 @@ public function testGetDirectoryContent() { new FileInfo('/bar/foo/asd', null, 'foo/asd', ['fileid' => 2, 'path' => '/bar/foo/asd', 'name' => 'asd', 'size' => 100, 'mtime' => 50, 'mimetype' => 'text/plain'], null), new FileInfo('/bar/foo/qwerty', null, 'foo/qwerty', ['fileid' => 3, 'path' => '/bar/foo/qwerty', 'name' => 'qwerty', 'size' => 200, 'mtime' => 55, 'mimetype' => 'httpd/unix-directory'], null), ]); + $view->method('getRelativePath') + ->willReturnCallback(function ($path) { + return $path; + }); $view->method('getFileInfo') ->willReturn($this->createMock(FileInfo::class));