1
0
Fork 0
mirror of synced 2024-06-02 19:04:49 +12:00

check if bucket exists in usage endpoint

This commit is contained in:
Damodar Lohani 2021-09-12 11:59:40 +05:45
parent c31bca52c1
commit 6d3a78f7a9

View file

@ -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') {