From c24f13529c06cb0166e6c0e9a2d1968435d726e1 Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Wed, 28 Feb 2024 15:33:58 -0500 Subject: [PATCH] Fallback to streaming after BufError --- crates/uv-client/src/error.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/crates/uv-client/src/error.rs b/crates/uv-client/src/error.rs index 28ec4fefe..3be5d7115 100644 --- a/crates/uv-client/src/error.rs +++ b/crates/uv-client/src/error.rs @@ -187,10 +187,10 @@ impl ErrorKind { } } - // The server doesn't support range requests, but we only discovered this while - // unzipping due to erroneous server behavior. Self::Zip(_, ZipError::UpstreamReadError(err)) => { if let Some(inner) = err.get_ref() { + // The server doesn't support range requests, but we only discovered this while + // unzipping due to erroneous server behavior. if let Some(inner) = inner.downcast_ref::() { if matches!( inner, @@ -199,6 +199,15 @@ impl ErrorKind { return true; } } + + // There was an I/O error (typically, a `BufError`) while reading from the + // server, which could be due to the server not supporting range requests. + if inner + .downcast_ref::() + .is_some_and(|error| error.kind() == std::io::ErrorKind::Other) + { + return true; + } } }