Merge pull request #41644 from nextcloud/backport/41623/stable26

This commit is contained in:
Julius Härtl 2023-11-24 13:25:18 +01:00 committed by GitHub
commit 472640ff95
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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;
}