mirror of
https://github.com/Xinrea/bili-shadowreplay.git
synced 2025-11-24 20:15:34 +08:00
fix: handle segment download error
This commit is contained in:
@@ -303,6 +303,11 @@ async fn download_inner(
|
||||
std::fs::create_dir_all(path.parent().unwrap()).unwrap();
|
||||
}
|
||||
let response = client.get(url).send().await?;
|
||||
if !response.status().is_success() {
|
||||
let status = response.status();
|
||||
log::warn!("Download segment failed: {url}: {status}");
|
||||
return Err(RecorderError::InvalidResponseStatus { status });
|
||||
}
|
||||
let bytes = response.bytes().await?;
|
||||
let size = bytes.len() as u64;
|
||||
let mut file = tokio::fs::File::create(&path).await?;
|
||||
|
||||
Reference in New Issue
Block a user