mirror of
https://github.com/nextcloud/bookmarks.git
synced 2025-07-22 01:22:31 +00:00
fix(ShareMapper#findBySharedFolder): Make sure exceptions are caught
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
This commit is contained in:
@ -177,6 +177,11 @@ class ShareMapper extends QBMapper {
|
||||
return parent::insertOrUpdate($entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws DoesNotExistException
|
||||
* @throws MultipleObjectsReturnedException
|
||||
* @throws Exception
|
||||
*/
|
||||
public function findBySharedFolder(int $id): Share {
|
||||
$qb = $this->db->getQueryBuilder();
|
||||
$qb->select(array_map(static function ($c) {
|
||||
|
@ -919,7 +919,12 @@ class TreeMapper extends QBMapper {
|
||||
return $array;
|
||||
}, $this->findChildren(TreeMapper::TYPE_FOLDER, $folderId, $isSoftDeleted));
|
||||
$shares = array_map(function (SharedFolder $sharedFolder) use ($layers, $folderId, $isSoftDeleted) {
|
||||
$share = $this->shareMapper->findBySharedFolder($sharedFolder->getId());
|
||||
try {
|
||||
$share = $this->shareMapper->findBySharedFolder($sharedFolder->getId());
|
||||
} catch (DoesNotExistException|MultipleObjectsReturnedException|Exception $e) {
|
||||
$this->logger->error('Failed to load a shared folder', ['exception' => $e]);
|
||||
return null;
|
||||
}
|
||||
$array = $sharedFolder->toArray();
|
||||
$array['id'] = $share->getFolderId();
|
||||
$array['userId'] = $share->getOwner();
|
||||
|
Reference in New Issue
Block a user