mirror of
https://github.com/flibusta-apps/telegram_files_cache_server.git
synced 2025-12-06 06:35:38 +01:00
Ignore 204 from files server
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -2,3 +2,5 @@
|
||||
|
||||
.vscode
|
||||
.env
|
||||
|
||||
.DS_Store
|
||||
|
||||
@@ -28,7 +28,7 @@ pub async fn download_from_downloader(
|
||||
source_id: u32,
|
||||
remote_id: u32,
|
||||
object_type: String,
|
||||
) -> Result<Response, Box<dyn std::error::Error + Send + Sync>> {
|
||||
) -> Result<Option<Response>, Box<dyn std::error::Error + Send + Sync>> {
|
||||
let url = format!(
|
||||
"{}/download/{source_id}/{remote_id}/{object_type}",
|
||||
CONFIG.downloader_url
|
||||
@@ -42,12 +42,10 @@ pub async fn download_from_downloader(
|
||||
.error_for_status()?;
|
||||
|
||||
if response.status() == StatusCode::NO_CONTENT {
|
||||
return Err(Box::new(DownloadError {
|
||||
status_code: StatusCode::NO_CONTENT,
|
||||
}));
|
||||
return Ok(None);
|
||||
};
|
||||
|
||||
Ok(response)
|
||||
Ok(Some(response))
|
||||
}
|
||||
|
||||
pub async fn get_filename(
|
||||
|
||||
@@ -138,7 +138,10 @@ pub async fn cache_file(
|
||||
|
||||
let downloader_result =
|
||||
match download_from_downloader(book.source.id, book.remote_id, object_type.clone()).await {
|
||||
Ok(v) => v,
|
||||
Ok(v) => match v {
|
||||
Some(v) => v,
|
||||
None => return None,
|
||||
},
|
||||
Err(err) => {
|
||||
log::error!("{:?}", err);
|
||||
return None;
|
||||
|
||||
Reference in New Issue
Block a user