mirror of
https://github.com/flibusta-apps/telegram_files_cache_server.git
synced 2025-12-06 06:35:38 +01:00
Fix
This commit is contained in:
@@ -42,10 +42,10 @@ pub async fn response_to_tempfile(res: &mut Response) -> Option<(SpooledTempFile
|
|||||||
|
|
||||||
data_size += data.len();
|
data_size += data.len();
|
||||||
|
|
||||||
match tmp_file.write(data.chunk()) {
|
match tmp_file.write_all(data.chunk()) {
|
||||||
Ok(_) => (),
|
Ok(_) => {}
|
||||||
Err(_) => return None,
|
Err(_) => return None,
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp_file.seek(SeekFrom::Start(0)).unwrap();
|
tmp_file.seek(SeekFrom::Start(0)).unwrap();
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
use std::fmt;
|
|
||||||
|
|
||||||
use reqwest::{Response, StatusCode};
|
use reqwest::{Response, StatusCode};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
|
||||||
@@ -11,19 +9,6 @@ pub struct FilenameData {
|
|||||||
pub filename_ascii: String,
|
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(
|
pub async fn download_from_downloader(
|
||||||
source_id: u32,
|
source_id: u32,
|
||||||
remote_id: u32,
|
remote_id: u32,
|
||||||
|
|||||||
Reference in New Issue
Block a user