From a4e160285683021431bcff75f257df654d56e748 Mon Sep 17 00:00:00 2001 From: bryan newbold Date: Sat, 4 Mar 2023 15:52:11 -0800 Subject: fix typo in IPLD conversion ('cid' not 'car') --- CHANGELOG.md | 1 + adenosine/src/ipld.rs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cc5a3a1..4ea0924 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ helpers, and probably client code and generated Lexicon code there. behavior) - repo: MST keys should not have leading `/` before collection NSID (following upstream behavior) +- ipld conversion: fix 'car' vs. 'cid' typo in special-case handling ## [0.2.0] - 2022-12-19 diff --git a/adenosine/src/ipld.rs b/adenosine/src/ipld.rs index 65a56e4..63f29dc 100644 --- a/adenosine/src/ipld.rs +++ b/adenosine/src/ipld.rs @@ -24,7 +24,7 @@ pub fn ipld_into_json_value(val: Ipld) -> Value { /// Crude reverse generation /// /// Does not handle base64 to bytes, and the link generation is pretty simple (object elements with -/// key "car"). Numbers always come through as f64 (float). +/// key "cid"). Numbers always come through as f64 (float). pub fn json_value_into_ipld(val: Value) -> Ipld { match val { Value::Null => Ipld::Null, @@ -35,7 +35,7 @@ pub fn json_value_into_ipld(val: Value) -> Ipld { Value::Array(l) => Ipld::List(l.into_iter().map(json_value_into_ipld).collect()), Value::Object(m) => { let map: BTreeMap = BTreeMap::from_iter(m.into_iter().map(|(k, v)| { - if k == "car" && v.is_string() { + if k == "cid" && v.is_string() { (k, Ipld::Link(Cid::from_str(v.as_str().unwrap()).unwrap())) } else { (k, json_value_into_ipld(v)) -- cgit v1.2.3