aboutsummaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2023-10-02 11:00:54 +0200
committermetamuffin <metamuffin@disroot.org>2023-10-02 11:00:54 +0200
commitaa0695aed60ac8568258aefb9d2ff5e9296111ae (patch)
treef9dc85c46af68ae8eab48b788309c81ac1aad87c /server
parentf0647823b2e430cb42fe176c4e637f09fd69c276 (diff)
downloadjellything-aa0695aed60ac8568258aefb9d2ff5e9296111ae.tar
jellything-aa0695aed60ac8568258aefb9d2ff5e9296111ae.tar.bz2
jellything-aa0695aed60ac8568258aefb9d2ff5e9296111ae.tar.zst
named cache and better error reporting
Diffstat (limited to 'server')
-rw-r--r--server/src/routes/ui/assets.rs8
1 files changed, 5 insertions, 3 deletions
diff --git a/server/src/routes/ui/assets.rs b/server/src/routes/ui/assets.rs
index 8c0496e..f88faa4 100644
--- a/server/src/routes/ui/assets.rs
+++ b/server/src/routes/ui/assets.rs
@@ -7,7 +7,7 @@ use crate::{
database::Database,
routes::ui::{account::session::Session, error::MyError, CacheControlFile},
};
-use anyhow::anyhow;
+use anyhow::{anyhow, Context};
use jellybase::AssetLocationExt;
use jellycommon::AssetLocation;
use log::info;
@@ -53,10 +53,12 @@ pub async fn r_item_assets(
));
// fit the resolution into a finite set so the maximum cache is finite too.
let width = 2usize.pow(width.unwrap_or(2048).clamp(128, 8196).ilog2());
- let path = jellytranscoder::image::transcode(asset, 50., 5, width).await?;
+ let path = jellytranscoder::image::transcode(asset, 50., 5, width)
+ .await
+ .context("transcoding asset")?;
info!("loading asset from {path:?}");
Ok((
ContentType::AVIF,
- CacheControlFile::new(File::open(path.path()).await?).await,
+ CacheControlFile::new(File::open(path.path()).await.context("opening file")?).await,
))
}