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 <konstin@mailbox.org>
This commit is contained in:
Zanie Blue 2023-12-20 04:55:23 -06:00 committed by GitHub
parent 665a59dae6
commit e705267dac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 7 deletions

View File

@ -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