aboutsummaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/src/routes/ui/assets.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/server/src/routes/ui/assets.rs b/server/src/routes/ui/assets.rs
index 2d175f9..f2c3f3f 100644
--- a/server/src/routes/ui/assets.rs
+++ b/server/src/routes/ui/assets.rs
@@ -47,7 +47,9 @@ pub async fn r_item_assets(
let asset = asset.unwrap_or(AssetLocation::Assets(
PathBuf::from_str("fallback.jpeg").unwrap(),
));
- let path = jellytranscoder::image::transcode(asset, 50., 5, width.unwrap_or(2048))?;
+ // 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)?;
info!("loading asset from {path:?}");
Ok((
ContentType::AVIF,