From 0c2bdb2ee3ed058a08c0112fa2bb4300412a2181 Mon Sep 17 00:00:00 2001 From: "Philip (a-0)" <@ph:a-0.me> Date: Sat, 23 Mar 2024 19:46:23 +0100 Subject: [PATCH] Bugfix: Lazily evaluate b64 address construction after b32 try --- ubisync-lib/src/types/peer_id.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ubisync-lib/src/types/peer_id.rs b/ubisync-lib/src/types/peer_id.rs index bff3923..8c4bf51 100644 --- a/ubisync-lib/src/types/peer_id.rs +++ b/ubisync-lib/src/types/peer_id.rs @@ -52,7 +52,7 @@ impl From for I2pSocketAddr { impl From for PeerId { fn from(value: I2pSocketAddr) -> Self { - Self::try_from_b32(&value.dest().string(), Some(value.port())).unwrap_or( + Self::try_from_b32(&value.dest().string(), Some(value.port())).unwrap_or_else(|_| Self::try_from_dest(&value.dest().string(), Some(value.port())).expect(&format!( "I2pSocketAddr was neither in b32 nor in b64 format: {value:?}" )),