From 4bf5b4274195ec0bf940c3d440fccda1cd2094e9 Mon Sep 17 00:00:00 2001 From: "Ian Clarke (aider)" Date: Mon, 23 Dec 2024 14:26:34 -0600 Subject: [PATCH] feat: Fix byte conversion and reader issues in freenet_api --- ui/src/components/app/freenet_api.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ui/src/components/app/freenet_api.rs b/ui/src/components/app/freenet_api.rs index ebb7a07..458d954 100644 --- a/ui/src/components/app/freenet_api.rs +++ b/ui/src/components/app/freenet_api.rs @@ -126,8 +126,9 @@ impl FreenetApiSynchronizer { // Handle incremental updates let mut rooms = use_context::>(); let mut rooms = rooms.write(); - if let Some(room_data) = rooms.map.get_mut(&VerifyingKey::from_bytes(&key.id().as_bytes()).expect("Invalid key bytes")) { - if let Ok(delta) = ciborium::from_reader(&update.unwrap_delta().as_ref()) { + let key_bytes: [u8; 32] = key.id().as_bytes().try_into().expect("Invalid key length"); + if let Some(room_data) = rooms.map.get_mut(&VerifyingKey::from_bytes(&key_bytes).expect("Invalid key bytes")) { + if let Ok(delta) = ciborium::from_reader(update.unwrap_delta().as_slice()) { if let Err(e) = room_data.room_state.apply_delta( &room_data.room_state, &room_data.parameters(),