0
0
Fork 0
mirror of https://github.com/nextcloud/server.git synced 2025-03-19 02:33:32 +00:00

fix: Also cleanup orphaned shares user cannot be found anymore

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl 2023-11-20 14:26:12 +01:00
parent 0da05fc73b
commit 9677ca062e
No known key found for this signature in database
GPG key ID: 4C614C6ED2CDE6DF

View file

@ -23,6 +23,7 @@ declare(strict_types=1);
namespace OCA\Files_Sharing;
use OC\User\NoUserException;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\Files\IRootFolder;
use OCP\IDBConnection;
@ -40,7 +41,11 @@ class OrphanHelper {
}
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;
}