Return an error when calling DELETE /tasks with an empty query

This commit is contained in:
Loïc Lecrenier 2022-10-15 11:17:06 +02:00 committed by Clément Renault
parent 9067148270
commit dabc30d3d6
No known key found for this signature in database
GPG key ID: 92ADA4E935E71FA4
4 changed files with 28 additions and 1 deletions

View file

@ -209,6 +209,9 @@ async fn delete_tasks(
index_uid,
uid,
};
if query.is_empty() {
return Err(index_scheduler::Error::TaskDeletionWithEmptyQuery.into());
}
let filtered_query = filter_out_inaccessible_indexes_from_query(&index_scheduler, &query);
@ -258,6 +261,7 @@ async fn get_tasks(
Some(&req),
);
// TODO: Lo: use `filter_out_inaccessible_indexes_from_query` here
let mut filters = index_scheduler::Query::default();
// Then we filter on potential indexes and make sure that the search filter