From e705267dacebb066bdf9637c888d8f07c0e13ade Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Wed, 20 Dec 2023 04:55:23 -0600 Subject: [PATCH] Fix fallback download when index does not support HTTP range requests (#702) Otherwise, when a server does not support HTTP range requests we throw an error instead of downloading without range requests. --------- Co-authored-by: konstin --- crates/puffin-client/src/registry_client.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/crates/puffin-client/src/registry_client.rs b/crates/puffin-client/src/registry_client.rs index 7469b72ad..dcfc9172a 100644 --- a/crates/puffin-client/src/registry_client.rs +++ b/crates/puffin-client/src/registry_client.rs @@ -300,16 +300,15 @@ impl RegistryClient { let result = self .client .get_cached_with_callback(req, &cache_entry, read_metadata_from_initial_response) - .await; + .await + .map_err(crate::Error::from); match result { - Ok(metadata) => { - return Ok(metadata); - } - Err(CachedClientError::Client(Error::AsyncHttpRangeReader( + Ok(metadata) => return Ok(metadata), + Err(Error::AsyncHttpRangeReader( AsyncHttpRangeReaderError::HttpRangeRequestUnsupported, - ))) => {} - Err(err) => return Err(err.into()), + )) => {} + Err(err) => return Err(err), } // The range request version failed (this is bad, the webserver should support this), fall