Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions apps/files_sharing/tests/CacheTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
Expand Down Expand Up @@ -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',
Expand Down
1 change: 1 addition & 0 deletions lib/private/Files/FileInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
2 changes: 0 additions & 2 deletions lib/private/Files/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions tests/lib/Files/ViewTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -414,17 +414,17 @@ 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);
$paths = [];
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'));
Expand Down
Loading