mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-16 15:21:24 +01:00
propagate corrupted media key errors
Now that we are able to distinguish between corrupted media keys and missing files, it makes more sense to propagate the corrupted keys up to the caller.
This commit is contained in:
parent
f0f81db99b
commit
14b44064b3
1 changed files with 5 additions and 5 deletions
|
|
@ -99,7 +99,7 @@ impl Service {
|
|||
&self,
|
||||
mxc: OwnedMxcUri,
|
||||
) -> Result<Option<(FileMeta, Vec<u8>)>> {
|
||||
if let Ok(Some((meta, key))) = self.db.search_file_metadata(mxc, 0, 0) {
|
||||
if let Some((meta, key)) = self.db.search_file_metadata(mxc, 0, 0)? {
|
||||
let path = services().globals.get_media_file(&key);
|
||||
let mut file_data = Vec::new();
|
||||
let Ok(mut file) = File::open(path).await else {
|
||||
|
|
@ -298,8 +298,8 @@ impl Service {
|
|||
let (width, height, crop) =
|
||||
Self::thumbnail_properties(width, height).unwrap_or((0, 0, false));
|
||||
|
||||
if let Ok(Some((meta, key))) =
|
||||
self.db.search_file_metadata(mxc.clone(), width, height)
|
||||
if let Some((meta, key)) =
|
||||
self.db.search_file_metadata(mxc.clone(), width, height)?
|
||||
{
|
||||
debug!("Using saved thumbnail");
|
||||
let path = services().globals.get_media_file(&key);
|
||||
|
|
@ -309,8 +309,8 @@ impl Service {
|
|||
return Ok(Some((meta, file.clone())));
|
||||
}
|
||||
|
||||
let Ok(Some((meta, key))) =
|
||||
self.db.search_file_metadata(mxc.clone(), 0, 0)
|
||||
let Some((meta, key)) =
|
||||
self.db.search_file_metadata(mxc.clone(), 0, 0)?
|
||||
else {
|
||||
debug!("Original image not found, can't generate thumbnail");
|
||||
return Ok(None);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue