Skip to content
Closed
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
10 changes: 4 additions & 6 deletions lib/Files/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,12 @@ public function __construct(
*/
public function getUsersWithAccessFile(string $fileId): array {
if (!isset($this->accessLists[$fileId])) {
$nodes = $this->rootFolder->getById((int)$fileId);
$node = $this->rootFolder->getFirstNodeById((int)$fileId);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The combination of both would be best, IUserFolder + getFirstNodeById.

But using getFirstNodeById should already help.

Copy link
Contributor Author

@artonge artonge Feb 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only did the easy no-brainer change, as using IUserFolder requires looking at the logic itself to understand whether it fit the situation

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay I will check then


if (empty($nodes)) {
if ($node === null) {
return [];
}

$node = array_shift($nodes);
$accessList = $this->shareManager->getAccessList($node);
$accessList['users'] ??= [];
if (!$node->getStorage()->instanceOfStorage(SharedStorage::class)) {
Expand All @@ -69,13 +68,12 @@ public function canUserAccessFile(string $fileId, string $userId): bool {

public function canGuestsAccessFile(string $fileId): bool {
if (!isset($this->publicAccessLists[$fileId])) {
$nodes = $this->rootFolder->getById((int)$fileId);
$node = $this->rootFolder->getFirstNodeById((int)$fileId);

if (empty($nodes)) {
if ($node === null) {
return false;
}

$node = array_shift($nodes);
$accessList = $this->shareManager->getAccessList($node, false);
$this->publicAccessLists[$fileId] = $accessList['public'] ?? false;
}
Expand Down
Loading