diff --git a/src/fetch/mod.rs b/src/fetch/mod.rs index 1964530..3bb9e18 100644 --- a/src/fetch/mod.rs +++ b/src/fetch/mod.rs @@ -132,8 +132,9 @@ async fn fetch_object_http_with_accept( req.send().await? }; - if let Some(location) = res.headers().get(LOCATION) { - let location: Url = location.to_str().unwrap().parse()?; + let location = res.headers().get(LOCATION).and_then(|l| l.to_str().ok()); + if let Some(location) = location { + let location = location.parse()?; return Box::pin(fetch_object_http_with_accept(&location, data, content_type)).await; } diff --git a/src/fetch/webfinger.rs b/src/fetch/webfinger.rs index a73e8c1..5f3b456 100644 --- a/src/fetch/webfinger.rs +++ b/src/fetch/webfinger.rs @@ -26,9 +26,6 @@ pub enum WebFingerError { /// The wefinger object did not contain any link to an activitypub item #[error("The webfinger object did not contain any link to an activitypub item")] NoValidLink, - /// Webfinger request was redirected which is not allowed - #[error("Webfinger request was redirected which is not allowed")] - RedirectNotAllowed, } impl WebFingerError {