From eb199b0b607f2f5c5e5f277a38f8a8fd4e0f5e4f Mon Sep 17 00:00:00 2001 From: rzmk <30333942+rzmk@users.noreply.github.com> Date: Wed, 1 Jul 2026 23:27:02 -0400 Subject: [PATCH] fix: add entry to multipart form body if value exists --- src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 2571af8..2248880 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -127,7 +127,9 @@ impl CKAN { let mut form = reqwest::multipart::Form::new(); if let Some(body_as_value) = body { for entry in body_as_value.as_object().unwrap().iter() { - form = form.text(entry.0.to_owned(), entry.1.as_str().unwrap().to_owned()); + if let Some(value) = entry.1.as_str() { + form = form.text(entry.0.to_owned(), value.to_owned()); + } } } form = form.file("upload", file_pathbuf).await?;