From af6de453229f3c1aeea43884cb850cc20cd3e179 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Thu, 23 Jan 2025 10:46:14 -0700 Subject: [PATCH] kumo.make_message: accepts bytes and not just utf8 Sometimes you have non-utf8 data that you want to load in --- crates/kumod/src/mod_kumo.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/kumod/src/mod_kumo.rs b/crates/kumod/src/mod_kumo.rs index d6abbd80..967c6a22 100644 --- a/crates/kumod/src/mod_kumo.rs +++ b/crates/kumod/src/mod_kumo.rs @@ -208,13 +208,13 @@ pub fn register(lua: &Lua) -> anyhow::Result<()> { kumo_mod.set( "make_message", lua.create_function( - move |_lua, (sender, recip, body): (String, String, String)| { + move |_lua, (sender, recip, body): (String, String, mlua::String)| { Message::new_dirty( SpoolId::new(), EnvelopeAddress::parse(&sender).map_err(any_err)?, EnvelopeAddress::parse(&recip).map_err(any_err)?, serde_json::json!({}), - Arc::new(body.into_bytes().into_boxed_slice()), + Arc::new(body.as_bytes().to_vec().into_boxed_slice()), ) .map_err(any_err) },