Skip to content

Commit

Permalink
Update CacheRootPermissionsMask.php
Browse files Browse the repository at this point in the history
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
  • Loading branch information
solracsf authored Jul 29, 2023
1 parent dd6339e commit 1aa909f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/Mount/CacheRootPermissionsMask.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,18 @@ public function __construct(ICache $cache, int $mask) {
$this->mask = $mask;
}

protected function formatCacheEntry($entry) {
protected function formatCacheEntry(string $entry): string {
$path = $entry['path'];
$isRoot = $path === '' || (strpos($path, '__groupfolders') === 0 && count(explode('/', $path)) === 2);
$isRoot = $path === '' || (str_starts_with($path, '__groupfolders/') && count(explode('/', $path)) === 2);

// Use null coalescing assignment operator
$entry['scan_permissions'] ??= $entry['permissions'];

if (isset($entry['permissions']) && $isRoot) {
$entry['scan_permissions'] = $entry['permissions'];
$entry['permissions'] &= $this->mask;
}

return $entry;
}

}

0 comments on commit 1aa909f

Please sign in to comment.