From 6ad49bbce1f59c8a3d3f76d025d87b428e5057be Mon Sep 17 00:00:00 2001 From: dawn <90008@gaze.systems> Date: Fri, 13 Feb 2026 23:49:50 +0300 Subject: [PATCH] [api] fix DbRkey deserialization in list_records --- src/api/xrpc.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/api/xrpc.rs b/src/api/xrpc.rs index 3c987be..3900bec 100644 --- a/src/api/xrpc.rs +++ b/src/api/xrpc.rs @@ -188,7 +188,17 @@ pub async fn handle_list_records( break; } - let rkey: DbRkey = rmp_serde::from_slice(&key[prefix.len()..]).into_diagnostic()?; + // manual deserialization of the key suffix since it is raw bytes, not msgpack + let suffix = &key[prefix.len()..]; + let rkey = if suffix.len() == 8 { + let mut bytes = [0u8; 8]; + bytes.copy_from_slice(suffix); + DbRkey::Tid(crate::db::types::DbTid::new_from_bytes(bytes)) + } else { + let s = String::from_utf8_lossy(suffix); + DbRkey::Str(smol_str::SmolStr::from(s.as_ref())) + }; + // look up using binary cid bytes from the record if let Ok(Some(block_bytes)) = blocks_ks.get(&cid_bytes) { let val: Data = serde_ipld_dagcbor::from_slice(&block_bytes).unwrap_or(Data::Null); -- 2.51.2