From 2c6e281c1643593cd079936924dc1d4e65c54ed6 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Wed, 11 Dec 2024 17:18:10 +0000 Subject: fix(NostrUrlDecoded): nip05 parsed as ssh user property `user`, which refers to the ssh user to be used when connecting to git remotes, was being parsed as the local section of the nip05 address --- src/lib/git/nostr_url.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/lib') diff --git a/src/lib/git/nostr_url.rs b/src/lib/git/nostr_url.rs index 39ce60e..ca616a0 100644 --- a/src/lib/git/nostr_url.rs +++ b/src/lib/git/nostr_url.rs @@ -136,7 +136,9 @@ impl NostrUrlDecoded { // extract optional protocol if protocol.is_none() { let part = parts.first().context(INCORRECT_NOSTR_URL_FORMAT_ERROR)?; - let protocol_str = if let Some(at_index) = part.find('@') { + let protocol_str = if part.contains('.') { + part + } else if let Some(at_index) = part.find('@') { user = Some(part[..at_index].to_string()); &part[at_index + 1..] } else { @@ -147,7 +149,7 @@ impl NostrUrlDecoded { "https" => Some(ServerProtocol::Https), "http" => Some(ServerProtocol::Http), "git" => Some(ServerProtocol::Git), - _ => protocol, + _ => None, }; if protocol.is_some() { parts.remove(0); -- cgit v1.2.3