~julienxx/castor

Safely unwrap URL host v1 APPLIED

Mark Dain: 1
 Safely unwrap URL host

 1 files changed, 1 insertions(+), 1 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~julienxx/castor/patches/15188/mbox | git am -3
Learn more about email & git

[PATCH] Safely unwrap URL host Export this patch

This commit fixes a crash that happens when the user attempts to
navigate to `gemini://'.

Castor now displays an error message:

    Could not connect to :1965
---
 src/gemini/client.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gemini/client.rs b/src/gemini/client.rs
index bf28cf7..882d81f 100644
--- a/src/gemini/client.rs
+++ b/src/gemini/client.rs
@@ -8,7 +8,7 @@ use crate::protocols::*;

pub fn get_data<T: Protocol>(url: T) -> Result<(Option<Vec<u8>>, Vec<u8>), String> {
    let url = url.get_source_url();
    let host = url.host_str().unwrap();
    let host = url.host_str().unwrap_or("");
    let port = url.port().unwrap_or(1965);
    let urlf = format!("{}:{}", host, port);

-- 
2.20.1
Applied, thanks!