diff options
Diffstat (limited to 'src/lib/repo_ref.rs')
| -rw-r--r-- | src/lib/repo_ref.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lib/repo_ref.rs b/src/lib/repo_ref.rs index c0f9136..c4dd820 100644 --- a/src/lib/repo_ref.rs +++ b/src/lib/repo_ref.rs | |||
| @@ -14,6 +14,7 @@ use nostr::{ | |||
| 14 | }; | 14 | }; |
| 15 | use nostr_sdk::{Kind, NostrSigner, RelayUrl, Timestamp, Url}; | 15 | use nostr_sdk::{Kind, NostrSigner, RelayUrl, Timestamp, Url}; |
| 16 | use serde::{Deserialize, Serialize}; | 16 | use serde::{Deserialize, Serialize}; |
| 17 | use urlencoding::encode as pct_encode; | ||
| 17 | 18 | ||
| 18 | #[cfg(not(test))] | 19 | #[cfg(not(test))] |
| 19 | use crate::client::Client; | 20 | use crate::client::Client; |
| @@ -661,7 +662,7 @@ pub fn detect_existing_grasp_servers( | |||
| 661 | } | 662 | } |
| 662 | 663 | ||
| 663 | let clone_url_is_grasp_server_format = if let Ok(npub) = extract_npub(url) { | 664 | let clone_url_is_grasp_server_format = if let Ok(npub) = extract_npub(url) { |
| 664 | url.contains(&format!("/{npub}/{identifier}.git")) | 665 | url.contains(&format!("/{npub}/{}.git", pct_encode(identifier))) |
| 665 | } else { | 666 | } else { |
| 666 | false | 667 | false |
| 667 | }; | 668 | }; |
| @@ -809,8 +810,9 @@ pub fn format_grasp_server_url_as_clone_url( | |||
| 809 | "https://" | 810 | "https://" |
| 810 | }; | 811 | }; |
| 811 | Ok(format!( | 812 | Ok(format!( |
| 812 | "{prefix}{grasp_server_url}/{}/{identifier}.git", | 813 | "{prefix}{grasp_server_url}/{}/{}.git", |
| 813 | public_key.to_bech32()? | 814 | public_key.to_bech32()?, |
| 815 | pct_encode(identifier) | ||
| 814 | )) | 816 | )) |
| 815 | } | 817 | } |
| 816 | 818 | ||