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

update suggestions

This commit is contained in:
Damodar Lohani 2021-06-20 16:40:24 +05:45
parent 17ec8bc28d
commit 18a8392c9b

View file

@ -281,7 +281,7 @@ App::post('/v1/storage/buckets/:bucketId/files')
$bucket = $dbForInternal->getDocument('buckets', $bucketId);
if($bucket->isEmpty()) {
throw new Exception("Unable to find the bucket", 404);
throw new Exception("Bucket not found", 404);
}
$file = $request->getFiles('file');
@ -416,6 +416,12 @@ App::get('/v1/storage/buckets/:bucketId/files')
/** @var Appwrite\Utopia\Response $response */
/** @var Utopia\Database\Database $dbForInternal */
$bucket = $dbForInternal->getDocument('buckets', $bucketId);
if($bucket->isEmpty()) {
throw new Exception("Bucket not found", 404);
}
$queries = [new Query('bucketId', Query::TYPE_EQUAL, [$bucketId])];
if($search) {
@ -448,9 +454,14 @@ App::get('/v1/storage/buckets/:bucketId/files/:fileId')
/** @var Utopia\Database\Database $dbForInternal */
$bucket = $dbForInternal->getDocument('buckets', $bucketId);
if($bucket->isEmpty()) {
throw new Exception("Bucket not found", 404);
}
$file = $dbForInternal->getDocument('files', $fileId);
if ($bucket->isEmpty() || $file->isEmpty()) {
if ($file->isEmpty()) {
throw new Exception('File not found', 404);
}