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