From 2f46d5c4a60dbe51b63dcb2a8a58212fd4525987 Mon Sep 17 00:00:00 2001 From: fogelito Date: Wed, 1 Mar 2023 18:39:38 +0200 Subject: [PATCH] tests fixes --- app/controllers/api/databases.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/controllers/api/databases.php b/app/controllers/api/databases.php index 1a21e8484c..1ea27af82b 100644 --- a/app/controllers/api/databases.php +++ b/app/controllers/api/databases.php @@ -2935,7 +2935,7 @@ App::get('/v1/databases/:databaseId/slow-queries/:documentId') ->inject('dbForProject') ->action(function (string $databaseId, string $documentId, Response $response, Database $dbForProject) { $document = $dbForProject->getDocument('slowQueries', $documentId); - if ($document->isEmpty()) { + if ($document->isEmpty() || $document->getAttribute('databaseId') !== $databaseId) { throw new Exception(Exception::DOCUMENT_NOT_FOUND); } @@ -2962,10 +2962,9 @@ App::delete('/v1/databases/:databaseId/slow-queries/:documentId') ->inject('dbForProject') ->action(function (string $databaseId, string $documentId, Response $response, Database $dbForProject) { $document = $dbForProject->getDocument('slowQueries', $documentId); - if ($document->isEmpty()) { + if ($document->isEmpty() || $document->getAttribute('databaseId') !== $databaseId) { throw new Exception(Exception::DOCUMENT_NOT_FOUND); } - $dbForProject->deleteDocument('slowQueries', $documentId); $dbForProject->deleteCachedDocument('slowQueries', $documentId);