Skip to content
Draft
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
8 changes: 7 additions & 1 deletion build/integration/features/bootstrap/Sharing.php
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,13 @@ public function shareXIsReturnedWith(int $number, TableNode $body) {

$returnedShare = $this->getXmlResponse()->data[0];
if ($returnedShare->element) {
$returnedShare = $returnedShare->element[$number];
$returnedShare = (array)$returnedShare;
$returnedShare = $returnedShare['element'];
if (is_array($returnedShare)) {
usort($returnedShare, fn ($share1, $share2) => (int)$share1->id <=> (int)$share2->id);
}

$returnedShare = $returnedShare[$number];
}

$defaultExpectedFields = [
Expand Down
3 changes: 1 addition & 2 deletions lib/private/Files/Cache/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,7 @@ public function getFolderContentsById(int $fileId, ?string $mimeTypeFilter = nul
$query = $this->getQueryBuilder();
$query->selectFileCache()
->whereParent($fileId)
->whereStorageId($this->getNumericStorageId())
->orderBy('name', 'ASC');
->whereStorageId($this->getNumericStorageId());

if ($mimeTypeFilter !== null) {
$mimetype = $this->mimetypeLoader->getId($mimeTypeFilter);
Expand Down
13 changes: 9 additions & 4 deletions tests/lib/Files/ViewTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ public function testCacheAPI(): void {
$this->assertEquals('httpd/unix-directory', $cachedData['mimetype']);

$folderData = $rootView->getDirectoryContent('/');
usort($folderData, fn (FileInfo $a, FileInfo $b) => $a->getName() <=> $b->getName());
/**
* expected entries:
* folder
Expand All @@ -234,6 +235,7 @@ public function testCacheAPI(): void {
$this->assertEquals($storageSize, $folderData[3]['size']);

$folderData = $rootView->getDirectoryContent('/substorage');
usort($folderData, fn (FileInfo $a, FileInfo $b) => $a->getName() <=> $b->getName());
/**
* expected entries:
* folder
Expand Down Expand Up @@ -2817,11 +2819,13 @@ public function testMountpointParentsCreated(): void {
$rootView = new View('');

$folderData = $rootView->getDirectoryContent('/');
usort($folderData, fn (FileInfo $a, FileInfo $b) => $a->getName() <=> $b->getName());
$this->assertCount(4, $folderData);
$this->assertEquals('folder', $folderData[0]['name']);
$this->assertEquals('foo.png', $folderData[1]['name']);
$this->assertEquals('foo.txt', $folderData[2]['name']);
$this->assertEquals('A', $folderData[3]['name']);

$this->assertEquals('A', $folderData[0]['name']);
$this->assertEquals('folder', $folderData[1]['name']);
$this->assertEquals('foo.png', $folderData[2]['name']);
$this->assertEquals('foo.txt', $folderData[3]['name']);

$folderData = $rootView->getDirectoryContent('/A');
$this->assertCount(1, $folderData);
Expand All @@ -2832,6 +2836,7 @@ public function testMountpointParentsCreated(): void {
$this->assertEquals('C', $folderData[0]['name']);

$folderData = $rootView->getDirectoryContent('/A/B/C');
usort($folderData, fn (FileInfo $a, FileInfo $b) => $a->getName() <=> $b->getName());
$this->assertCount(3, $folderData);
$this->assertEquals('folder', $folderData[0]['name']);
$this->assertEquals('foo.png', $folderData[1]['name']);
Expand Down
Loading