mirror of
https://github.com/nextcloud/server.git
synced 2026-02-20 00:12:30 -05:00
fix(comments): Don's catch invalid DriverException
These are nowadays also OCP\DB\Exception and if the id is not a numeric deleting by id is also non working. Signed-off-by: Carl Schwan <carl.schwan@nextclound.com>
This commit is contained in:
parent
9b2fff5931
commit
996be0f441
1 changed files with 9 additions and 8 deletions
|
|
@ -7,8 +7,6 @@
|
|||
*/
|
||||
namespace OC\Comments;
|
||||
|
||||
use Doctrine\DBAL\Exception\DriverException;
|
||||
use OCA\DAV\Connector\Sabre\File;
|
||||
use OCP\AppFramework\Utility\ITimeFactory;
|
||||
use OCP\Comments\CommentsEvent;
|
||||
use OCP\Comments\IComment;
|
||||
|
|
@ -876,20 +874,23 @@ class Manager implements ICommentsManager {
|
|||
|
||||
try {
|
||||
$comment = $this->get($id);
|
||||
} catch (\Exception $e) {
|
||||
} catch (\Exception) {
|
||||
// Ignore exceptions, we just don't fire a hook then
|
||||
$comment = null;
|
||||
}
|
||||
|
||||
if (!is_numeric($id)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$qb = $this->dbConn->getQueryBuilder();
|
||||
$query = $qb->delete('comments')
|
||||
->where($qb->expr()->eq('id', $qb->createParameter('id')))
|
||||
->setParameter('id', $id);
|
||||
->where($qb->expr()->eq('id', $qb->createNamedParameter((int)$id, IQueryBuilder::PARAM_INT)));
|
||||
|
||||
try {
|
||||
$affectedRows = $query->executeStatement();
|
||||
$this->uncache($id);
|
||||
} catch (DriverException $e) {
|
||||
} catch (Exception $e) {
|
||||
$this->logger->error($e->getMessage(), [
|
||||
'exception' => $e,
|
||||
'app' => 'core_comments',
|
||||
|
|
@ -1332,7 +1333,7 @@ class Manager implements ICommentsManager {
|
|||
|
||||
try {
|
||||
$affectedRows = $query->executeStatement();
|
||||
} catch (DriverException $e) {
|
||||
} catch (Exception $e) {
|
||||
$this->logger->error($e->getMessage(), [
|
||||
'exception' => $e,
|
||||
'app' => 'core_comments',
|
||||
|
|
@ -1439,7 +1440,7 @@ class Manager implements ICommentsManager {
|
|||
|
||||
try {
|
||||
$affectedRows = $query->executeStatement();
|
||||
} catch (DriverException $e) {
|
||||
} catch (Exception $e) {
|
||||
$this->logger->error($e->getMessage(), [
|
||||
'exception' => $e,
|
||||
'app' => 'core_comments',
|
||||
|
|
|
|||
Loading…
Reference in a new issue