diff options
Diffstat (limited to 'server/src/routes/ui/assets.rs')
-rw-r--r-- | server/src/routes/ui/assets.rs | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/server/src/routes/ui/assets.rs b/server/src/routes/ui/assets.rs index ebd9453..d5d2839 100644 --- a/server/src/routes/ui/assets.rs +++ b/server/src/routes/ui/assets.rs @@ -19,7 +19,6 @@ pub use jellycommon::AssetRole; use jellycommon::{AssetLocation, LocalTrack, PeopleGroup, SourceTrackKind, TrackSource}; use log::info; use rocket::{get, http::ContentType, State}; -use std::{path::PathBuf, str::FromStr}; use tokio::fs::File; #[get("/n/<id>/asset?<role>&<width>")] @@ -51,7 +50,7 @@ pub async fn r_item_assets( } }; let asset = asset.unwrap_or(AssetLocation::Assets( - PathBuf::from_str("fallback.avif").unwrap(), + format!("fallback-{:?}.avif", node.public.kind.unwrap_or_default()).into(), )); Ok(asset_with_res(asset, width).await?) } @@ -78,13 +77,9 @@ pub async fn r_person_asset( .get(index) .ok_or(anyhow!("person does not exist"))?; - let asset = app - .person - .asset - .as_ref() - .ok_or(anyhow!("no asset"))? - .to_owned(); - + let asset = app.person.asset.to_owned().unwrap_or(AssetLocation::Assets( + format!("fallback-Person.avif").into(), + )); Ok(asset_with_res(asset, width).await?) } |