Merge pull request #2526 from appwrite/fix-query-value-limits
fix: database query value limits
This commit is contained in:
commit
21158e5a96
|
@ -1717,7 +1717,15 @@ App::get('/v1/database/collections/:collectionId/documents')
|
|||
}
|
||||
}
|
||||
|
||||
$queries = \array_map(fn ($query) => Query::parse($query), $queries);
|
||||
$queries = \array_map(function ($query) {
|
||||
$query = Query::parse($query);
|
||||
|
||||
if (\count($query->getValues()) > 100) {
|
||||
throw new Exception("You cannot use more than 100 query values on attribute '{$query->getAttribute()}'", 400);
|
||||
}
|
||||
|
||||
return $query;
|
||||
}, $queries);
|
||||
|
||||
if (!empty($queries)) {
|
||||
$validator = new QueriesValidator(new QueryValidator($collection->getAttribute('attributes', [])), $collection->getAttribute('indexes', []), true);
|
||||
|
|
|
@ -1212,6 +1212,21 @@ trait DatabaseBase
|
|||
$this->assertEquals(400, $documents['headers']['status-code']);
|
||||
$this->assertEquals('Index not found: actors', $documents['body']['message']);
|
||||
|
||||
$conditions = [];
|
||||
|
||||
for ($i=0; $i < 101; $i++) {
|
||||
$conditions[] = $i;
|
||||
}
|
||||
|
||||
$documents = $this->client->call(Client::METHOD_GET, '/database/collections/' . $data['moviesId'] . '/documents', array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'queries' => ['releaseYear.equal(' . implode(',', $conditions) . ')'],
|
||||
]);
|
||||
|
||||
$this->assertEquals(400, $documents['headers']['status-code']);
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue