service/media: use upload_thumbnail() in get_thumbnail()

This commit is contained in:
Lambda 2024-09-01 15:48:05 +00:00
parent c1ea25e1e0
commit 0cf2499e5e

View file

@ -327,14 +327,16 @@ impl Service {
debug!("Saving created thumbnail");
// Save thumbnail in database so we don't have to generate it
// again next time
let thumbnail_key =
self.db.create_file_metadata(mxc, width, height, &meta)?;
let path = services().globals.get_media_file(&thumbnail_key);
let mut f = File::create(path).await?;
f.write_all(&thumbnail_bytes).await?;
let meta = self
.upload_thumbnail(
mxc,
meta.content_disposition,
meta.content_type,
width,
height,
&thumbnail_bytes,
)
.await?;
Ok(Some((meta, thumbnail_bytes.clone())))
}