diff --git a/src/services/download_utils.rs b/src/services/download_utils.rs index 859747f..95e4844 100644 --- a/src/services/download_utils.rs +++ b/src/services/download_utils.rs @@ -42,10 +42,10 @@ pub async fn response_to_tempfile(res: &mut Response) -> Option<(SpooledTempFile data_size += data.len(); - match tmp_file.write(data.chunk()) { - Ok(_) => (), + match tmp_file.write_all(data.chunk()) { + Ok(_) => {} Err(_) => return None, - } + }; } tmp_file.seek(SeekFrom::Start(0)).unwrap(); diff --git a/src/services/downloader/mod.rs b/src/services/downloader/mod.rs index 9c93d36..c410a36 100644 --- a/src/services/downloader/mod.rs +++ b/src/services/downloader/mod.rs @@ -1,5 +1,3 @@ -use std::fmt; - use reqwest::{Response, StatusCode}; use serde::Deserialize; @@ -11,19 +9,6 @@ pub struct FilenameData { pub filename_ascii: String, } -#[derive(Debug, Clone)] -struct DownloadError { - status_code: StatusCode, -} - -impl fmt::Display for DownloadError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "Status code is {0}", self.status_code) - } -} - -impl std::error::Error for DownloadError {} - pub async fn download_from_downloader( source_id: u32, remote_id: u32,