check if bucket exists in usage endpoint
This commit is contained in:
parent
c31bca52c1
commit
6d3a78f7a9
|
@ -1259,7 +1259,11 @@ App::get('/v1/storage/:bucketId/usage')
|
|||
/** @var Appwrite\Utopia\Response $response */
|
||||
/** @var Utopia\Database\Database $dbForInternal */
|
||||
|
||||
// TODO: Check if the storage bucket exists else throw 404
|
||||
$bucket = $dbForInternal->getDocument('buckets', $bucketId);
|
||||
|
||||
if($bucket->isEmpty()) {
|
||||
throw new Exception('Bucket not found', 404);
|
||||
}
|
||||
|
||||
$usage = [];
|
||||
if (App::getEnv('_APP_USAGE_STATS', 'enabled') == 'enabled') {
|
||||
|
|
Loading…
Reference in a new issue