diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2024-12-11 17:18:10 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2024-12-11 17:18:10 +0000 |
| commit | 2c6e281c1643593cd079936924dc1d4e65c54ed6 (patch) | |
| tree | 28ef53cb19f8eec8fb1e1efb0921f8137a8e1a4f | |
| parent | c72585a97736384ebe9e8e82a6311387808051fa (diff) | |
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
| -rw-r--r-- | src/lib/git/nostr_url.rs | 6 |
1 files changed, 4 insertions, 2 deletions
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 { | |||
| 136 | // extract optional protocol | 136 | // extract optional protocol |
| 137 | if protocol.is_none() { | 137 | if protocol.is_none() { |
| 138 | let part = parts.first().context(INCORRECT_NOSTR_URL_FORMAT_ERROR)?; | 138 | let part = parts.first().context(INCORRECT_NOSTR_URL_FORMAT_ERROR)?; |
| 139 | let protocol_str = if let Some(at_index) = part.find('@') { | 139 | let protocol_str = if part.contains('.') { |
| 140 | part | ||
| 141 | } else if let Some(at_index) = part.find('@') { | ||
| 140 | user = Some(part[..at_index].to_string()); | 142 | user = Some(part[..at_index].to_string()); |
| 141 | &part[at_index + 1..] | 143 | &part[at_index + 1..] |
| 142 | } else { | 144 | } else { |
| @@ -147,7 +149,7 @@ impl NostrUrlDecoded { | |||
| 147 | "https" => Some(ServerProtocol::Https), | 149 | "https" => Some(ServerProtocol::Https), |
| 148 | "http" => Some(ServerProtocol::Http), | 150 | "http" => Some(ServerProtocol::Http), |
| 149 | "git" => Some(ServerProtocol::Git), | 151 | "git" => Some(ServerProtocol::Git), |
| 150 | _ => protocol, | 152 | _ => None, |
| 151 | }; | 153 | }; |
| 152 | if protocol.is_some() { | 154 | if protocol.is_some() { |
| 153 | parts.remove(0); | 155 | parts.remove(0); |