Skip to content

Commit 4b00db9

Browse files
committed
fix: clear in-memory cached mounts for user when adding/removing mounts
Signed-off-by: Robin Appelman <robin@icewind.nl>
1 parent d2f2135 commit 4b00db9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/private/Files/Config/UserMountCache.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,12 @@ public function removeMount(string $mountPoint): void {
536536
$query->delete('mounts')
537537
->where($query->expr()->eq('mount_point', $query->createNamedParameter($mountPoint)));
538538
$query->executeStatement();
539+
540+
$parts = explode('/', $mountPoint);
541+
if (count($parts) > 3) {
542+
[, $userId] = $parts;
543+
unset($this->mountsForUsers[$userId]);
544+
}
539545
}
540546

541547
public function addMount(IUser $user, string $mountPoint, ICacheEntry $rootCacheEntry, string $mountProvider, ?int $mountId = null): void {
@@ -553,6 +559,7 @@ public function addMount(IUser $user, string $mountPoint, ICacheEntry $rootCache
553559

554560
try {
555561
$query->executeStatement();
562+
unset($this->mountsForUsers[$user->getUID()]);
556563
} catch (DbalException $e) {
557564
if ($e->getReason() !== DbalException::REASON_UNIQUE_CONSTRAINT_VIOLATION) {
558565
throw $e;

0 commit comments

Comments
 (0)