fix: release db connection
This commit is contained in:
parent
0bd531a21d
commit
71f6f47a00
@ -389,7 +389,12 @@ pub async fn get_blob_thumb(
|
||||
if id.len() != 32 {
|
||||
return Err(Status::NotFound);
|
||||
}
|
||||
if let Ok(Some(info)) = db.get_file(&id).await {
|
||||
let info = if let Ok(Some(info)) = db.get_file(&id).await {
|
||||
info
|
||||
} else {
|
||||
return Err(Status::NotFound);
|
||||
};
|
||||
|
||||
let file_path = fs.get(&id);
|
||||
|
||||
let mut thumb_file = temp_dir().join(format!("thumb_{}", sha256));
|
||||
@ -403,17 +408,17 @@ pub async fn get_blob_thumb(
|
||||
};
|
||||
|
||||
if let Ok(f) = File::open(&thumb_file).await {
|
||||
return Ok(FilePayload {
|
||||
Ok(FilePayload {
|
||||
file: f,
|
||||
info: FileUpload {
|
||||
size: thumb_file.metadata().unwrap().len(),
|
||||
mime_type: "image/webp".to_string(),
|
||||
..info
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
Err(Status::NotFound)
|
||||
}
|
||||
}
|
||||
|
||||
/// Legacy URL redirect for void.cat uploads
|
||||
|
Loading…
x
Reference in New Issue
Block a user