Skip to content

Commit

Permalink
fix(backend): allow multiple files per field when using multipart (#5002
Browse files Browse the repository at this point in the history
)
  • Loading branch information
HugoCasa authored Jan 2, 2025
1 parent eeece84 commit 383ecf8
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions backend/windmill-api/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ impl WebhookArgs {
let s3_client = build_object_store_client(&s3_resource).await?;

let mut body = HashMap::new();
let mut files = HashMap::new();

while let Some(field) = multipart.next_field().await.map_err(|e| {
Error::BadRequest(format!(
Expand Down Expand Up @@ -107,12 +108,9 @@ impl WebhookArgs {
)
.await?;

body.insert(
name,
to_raw_value(&serde_json::json!({
"s3": &file_key
})),
);
files.entry(name).or_insert(vec![]).push(serde_json::json!({
"s3": &file_key
}));
} else {
body.insert(
name,
Expand All @@ -122,6 +120,10 @@ impl WebhookArgs {
}
}

for (k, v) in files {
body.insert(k, to_raw_value(&v));
}

if self.wrap_body.unwrap_or(false) {
self.args
.args
Expand Down

0 comments on commit 383ecf8

Please sign in to comment.