Fix the error messages categorization with invalid NDJson

This commit is contained in:
Kerollmops 2024-12-11 10:08:49 +01:00
parent d683f5980c
commit 69c931334f
No known key found for this signature in database
GPG Key ID: F250A4C4E3AE5F5F

View File

@ -624,13 +624,12 @@ async fn document_addition(
None => None,
};
let documents_count = file
.as_ref()
.map_or(Ok(0), |ntf| read_ndjson(ntf.as_file()))
.map_err(|e| MeilisearchHttpError::Payload(ReceivePayload(Box::new(e))));
let documents_count = file.as_ref().map_or(Ok(0), |ntf| {
read_ndjson(ntf.as_file()).map_err(MeilisearchHttpError::DocumentFormat)
})?;
let update_file = file_store::File::from_parts(path, file);
update_file.persist()?;
Ok(documents_count)
Ok(Ok(documents_count))
}
PayloadType::Json | PayloadType::Csv { delimiter: _ } => {
let temp_file = match tempfile() {