Skip to content

Commit

Permalink
fix: Also cleanup orphaned shares user cannot be found anymore
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <jus@bitgrid.net>
  • Loading branch information
juliusknorr authored and backportbot-nextcloud[bot] committed Nov 21, 2023
1 parent ef67f00 commit ce9e5e6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion apps/files_sharing/lib/OrphanHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

namespace OCA\Files_Sharing;

use OC\User\NoUserException;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\Files\IRootFolder;
use OCP\IDBConnection;
Expand All @@ -40,7 +41,11 @@ public function __construct(
}

public function isShareValid(string $owner, int $fileId): bool {
$userFolder = $this->rootFolder->getUserFolder($owner);
try {
$userFolder = $this->rootFolder->getUserFolder($owner);
} catch (NoUserException $e) {
return false;
}
$nodes = $userFolder->getById($fileId);
return count($nodes) > 0;
}
Expand Down

0 comments on commit ce9e5e6

Please sign in to comment.