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:
@@ -98,8 +98,6 @@ pub async fn download_from_cache(
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
tokio::spawn(cache_file(cached_data.object_id, cached_data.object_type, db));
|
||||
|
||||
log::error!("{:?}", err);
|
||||
return None;
|
||||
},
|
||||
|
||||
14
src/views.rs
14
src/views.rs
@@ -27,15 +27,23 @@ async fn download_cached_file(
|
||||
Path((object_id, object_type)): Path<(i32, String)>,
|
||||
Extension(Ext { db }): Extension<Ext>
|
||||
) -> impl IntoResponse {
|
||||
let cached_file = match get_cached_file_or_cache(object_id, object_type, db.clone()).await {
|
||||
let cached_file = match get_cached_file_or_cache(object_id, object_type.clone(), db.clone()).await {
|
||||
Some(cached_file) => cached_file,
|
||||
None => return StatusCode::NO_CONTENT.into_response(),
|
||||
};
|
||||
|
||||
let data = match download_from_cache(cached_file, db).await {
|
||||
let data = match download_from_cache(cached_file, db.clone()).await {
|
||||
Some(v) => v,
|
||||
None => {
|
||||
return StatusCode::NO_CONTENT.into_response();
|
||||
let cached_file = match get_cached_file_or_cache(object_id, object_type, db.clone()).await {
|
||||
Some(v) => v,
|
||||
None => return StatusCode::NO_CONTENT.into_response(),
|
||||
};
|
||||
|
||||
match download_from_cache(cached_file, db).await {
|
||||
Some(v) => v,
|
||||
None => return StatusCode::NO_CONTENT.into_response(),
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user