Skip to content

Commit

Permalink
Don't mount shares with failed underlying storages
Browse files Browse the repository at this point in the history
  • Loading branch information
jvillafanez committed Oct 6, 2023
1 parent 79b9478 commit 692c9be
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion apps/files_sharing/lib/MountProvider.php
Expand Up @@ -82,7 +82,7 @@ public function getMountsForUser(IUser $user, IStorageFactory $storageFactory) {
$mounts = [];
foreach ($superShares as $share) {
try {
$mounts[] = new SharedMount(
$shareMount = new SharedMount(
'\OCA\Files_Sharing\SharedStorage',
$mounts,
[
Expand All @@ -94,6 +94,13 @@ public function getMountsForUser(IUser $user, IStorageFactory $storageFactory) {
],
$storageFactory
);

$shareStorage = $shareMount->getStorage();
if ($shareStorage !== null && $shareStorage->getPermissions('') !== 0) {
// permissions = 0 implies that the underlying storage
// being shared isn't valid
$mounts[] = $shareMount;
}
} catch (\Exception $e) {
$this->logger->logException($e);
$this->logger->error('Error while trying to create shared mount');
Expand Down

0 comments on commit 692c9be

Please sign in to comment.