Skip to content

Commit 5a9bce9

Browse files
committed
fix: fixed handling of input of tasks
When provided invalid column-names for the tasks, they were not checked against the dataset. This missing check was now added. Signed-off-by: Tobias Anker <tobias.anker@kitsunemimi.moe>
1 parent 534e04c commit 5a9bce9

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
- support other namespaces thand "default"
2121
- support for multiple sakura instances
2222
- validation for task-input to avoid a mismatch between given input and the model
23+
- validation for task-input to avoid a mismatch between given input and the dataset
2324
- dashboard:
2425
- added error-popups
2526
- validation of input-fields and error-message for invalid inputs

src/binaries/sakura/src/api/http_endpoints/model/task/mod.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,15 @@ async fn handle_input(
306306
.await
307307
.map_err(map_ainari_error_to_api_response)?;
308308

309+
// check if requested column even exist in the dataset
310+
if dataset_resp.column_names.contains(&input.dataset_column) == false {
311+
let msg = format!(
312+
"Dataset-column with name '{}' doesn't exist in dataset with UUID '{}'",
313+
input.dataset_column, input.dataset_uuid
314+
);
315+
return Err(ErrorResponse::BadRequest(msg));
316+
}
317+
309318
// create temp-file-paths
310319
let local_file_path = format!("{}/{}", temp_dir, dataset_resp.uuid);
311320
let local_encrypted_file_path = format!("{local_file_path}_encrypted");

0 commit comments

Comments
 (0)