diff --git a/apps/files_sharing/tests/CacheTest.php b/apps/files_sharing/tests/CacheTest.php index 777f3b1d0c65a..0e4736ff25c2b 100644 --- a/apps/files_sharing/tests/CacheTest.php +++ b/apps/files_sharing/tests/CacheTest.php @@ -230,14 +230,14 @@ public function testGetFolderContentsInRoot(): void { [ [ 'name' => 'shareddir', - 'path' => 'files/shareddir', + 'path' => '/' . self::TEST_FILES_SHARING_API_USER2 . '/files/shareddir', 'mimetype' => 'httpd/unix-directory', 'uid_owner' => self::TEST_FILES_SHARING_API_USER1, 'displayname_owner' => 'User One', ], [ 'name' => 'shared single file.txt', - 'path' => 'files/shared single file.txt', + 'path' => '/' . self::TEST_FILES_SHARING_API_USER2 . '/files/shared single file.txt', 'mimetype' => 'text/plain', 'uid_owner' => self::TEST_FILES_SHARING_API_USER1, 'displayname_owner' => 'User One', @@ -254,21 +254,21 @@ public function testGetFolderContentsInSubdir(): void { [ [ 'name' => 'bar.txt', - 'path' => 'bar.txt', + 'path' => '/' . self::TEST_FILES_SHARING_API_USER2 . '/files/shareddir/bar.txt', 'mimetype' => 'text/plain', 'uid_owner' => self::TEST_FILES_SHARING_API_USER1, 'displayname_owner' => 'User One', ], [ 'name' => 'emptydir', - 'path' => 'emptydir', + 'path' => '/' . self::TEST_FILES_SHARING_API_USER2 . '/files/shareddir/emptydir', 'mimetype' => 'httpd/unix-directory', 'uid_owner' => self::TEST_FILES_SHARING_API_USER1, 'displayname_owner' => 'User One', ], [ 'name' => 'subdir', - 'path' => 'subdir', + 'path' => '/' . self::TEST_FILES_SHARING_API_USER2 . '/files/shareddir/subdir', 'mimetype' => 'httpd/unix-directory', 'uid_owner' => self::TEST_FILES_SHARING_API_USER1, 'displayname_owner' => 'User One', @@ -336,21 +336,21 @@ public function testGetFolderContentsWhenSubSubdirShared(): void { [ [ 'name' => 'another too.txt', - 'path' => 'another too.txt', + 'path' => '/' . self::TEST_FILES_SHARING_API_USER3 . '/files/subdir/another too.txt', 'mimetype' => 'text/plain', 'uid_owner' => self::TEST_FILES_SHARING_API_USER1, 'displayname_owner' => 'User One', ], [ 'name' => 'another.txt', - 'path' => 'another.txt', + 'path' => '/' . self::TEST_FILES_SHARING_API_USER3 . '/files/subdir/another.txt', 'mimetype' => 'text/plain', 'uid_owner' => self::TEST_FILES_SHARING_API_USER1, 'displayname_owner' => 'User One', ], [ 'name' => 'not a text file.xml', - 'path' => 'not a text file.xml', + 'path' => '/' . self::TEST_FILES_SHARING_API_USER3 . '/files/subdir/not a text file.xml', 'mimetype' => 'application/xml', 'uid_owner' => self::TEST_FILES_SHARING_API_USER1, 'displayname_owner' => 'User One', diff --git a/lib/private/Files/FileInfo.php b/lib/private/Files/FileInfo.php index d864ebe2a0913..a80e1e30a6611 100644 --- a/lib/private/Files/FileInfo.php +++ b/lib/private/Files/FileInfo.php @@ -82,6 +82,7 @@ public function offsetUnset($offset): void { public function offsetGet(mixed $offset): mixed { return match ($offset) { + 'path' => $this->getPath(), 'type' => $this->getType(), 'etag' => $this->getEtag(), 'size' => $this->getSize(), diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php index 5e728d0a8d0a1..13e6a3995dccb 100644 --- a/lib/private/Files/View.php +++ b/lib/private/Files/View.php @@ -1642,8 +1642,6 @@ public function getDirectoryContent(string $directory, ?string $mimeTypeFilter = $rootEntry['permissions'] = $permissions & (Constants::PERMISSION_ALL - (Constants::PERMISSION_UPDATE | Constants::PERMISSION_DELETE)); } - $rootEntry['path'] = substr(Filesystem::normalizePath($path . '/' . $rootEntry['name']), strlen($user) + 2); // full path without /$user/ - // if sharing was disabled for the user we remove the share permissions if ($sharingDisabled) { $rootEntry['permissions'] = $rootEntry['permissions'] & ~Constants::PERMISSION_SHARE; diff --git a/tests/lib/Files/ViewTest.php b/tests/lib/Files/ViewTest.php index ce20ce7835a01..94d55b4e9c411 100644 --- a/tests/lib/Files/ViewTest.php +++ b/tests/lib/Files/ViewTest.php @@ -414,8 +414,8 @@ public function testSearch(): void { foreach ($results as $result) { $paths[] = $result['path']; } - $this->assertContains('/anotherstorage/folder/bar.txt', $paths); - $this->assertContains('/bar.txt', $paths); + $this->assertContains('/folder/anotherstorage/folder/bar.txt', $paths); + $this->assertContains('/folder/bar.txt', $paths); $results = $folderView->search('foo'); $this->assertCount(2, $results); @@ -423,8 +423,8 @@ public function testSearch(): void { foreach ($results as $result) { $paths[] = $result['path']; } - $this->assertContains('/anotherstorage/foo.txt', $paths); - $this->assertContains('/anotherstorage/foo.png', $paths); + $this->assertContains('/folder/anotherstorage/foo.txt', $paths); + $this->assertContains('/folder/anotherstorage/foo.png', $paths); $this->assertCount(6, $rootView->searchByMime('text')); $this->assertCount(3, $folderView->searchByMime('text'));