mirror of
https://github.com/flibusta-apps/telegram_files_cache_server.git
synced 2025-12-06 14:45:36 +01:00
Fix download empty files
This commit is contained in:
@@ -181,7 +181,22 @@ pub async fn download_from_cache(
|
||||
let book_task = tokio::task::spawn(get_book(cached_data.object_id));
|
||||
|
||||
let response = match response_task.await.unwrap() {
|
||||
Ok(v) => v,
|
||||
Ok(v) => {
|
||||
if v.status() != 200 {
|
||||
db.cached_file()
|
||||
.delete(cached_file::object_id_object_type(
|
||||
cached_data.object_id,
|
||||
cached_data.object_type.clone(),
|
||||
))
|
||||
.exec()
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
return None;
|
||||
}
|
||||
|
||||
v
|
||||
}
|
||||
Err(err) => {
|
||||
db.cached_file()
|
||||
.delete(cached_file::object_id_object_type(
|
||||
|
||||
Reference in New Issue
Block a user