From c91c5cfbac981593769296d766e036f0124820d0 Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Mon, 17 May 2021 12:37:48 +0300 Subject: [PATCH] Added project exists check --- app/controllers/general.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index a87304b412..d912d4770f 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -85,7 +85,11 @@ App::init(function ($utopia, $request, $response, $console, $project, $consoleDB $route = $utopia->match($request); - if (!empty($route->getLabel('sdk.auth', [])) && empty($project->getId()) && ($route->getLabel('scope', '') !== 'public')) { + if ($project->isEmpty()) { + throw new Exception('Project not found', 404); + } + + if (!empty($route->getLabel('sdk.auth', [])) && $project->isEmpty() && ($route->getLabel('scope', '') !== 'public')) { throw new Exception('Missing or unknown project ID', 400); }