commit 9ce8b4dfc519b132ae06050c3f62286627388292 parent 41e5f8af46091c8b3f2ecbef5b767dd3a74cf11d Author: Zack Newman <zack@philomathiclife.com> Date: Sat, 9 Nov 2024 20:46:17 -0700 fix bug in cipher fields Diffstat:
M | src/db/models/cipher.rs | | | 31 | +++++++++++++++++-------------- |
1 file changed, 17 insertions(+), 14 deletions(-)
diff --git a/src/db/models/cipher.rs b/src/db/models/cipher.rs @@ -141,22 +141,25 @@ impl Cipher { }) .map_or(Value::Null, |d| { d.into_iter() - .map(|mut da| match da.data.get("type") { - None => { - da.data["type"] = json!(1i32); - } - Some(x) => { - if x.is_string() { - let type_num = x - .as_str() - .unwrap_or_else(|| { - unreachable!("there is a bug in Value::is_string") - }) - .parse::<u8>() - .unwrap_or(1); - da.data["type"] = json!(type_num); + .map(|mut da| { + match da.data.get("type") { + None => { + da.data["type"] = json!(1i32); + } + Some(x) => { + if x.is_string() { + let type_num = x + .as_str() + .unwrap_or_else(|| { + unreachable!("there is a bug in Value::is_string") + }) + .parse::<u8>() + .unwrap_or(1); + da.data["type"] = json!(type_num); + } } } + da.data }) .collect() });