From 242d5763d451eed2402be7afde50cd9fa0d6bc79 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Tue, 9 Dec 2025 16:23:21 +0100 Subject: fix cache name escape bugs --- import/src/tmdb.rs | 33 ++++++++++++++++++--------------- import/src/trakt.rs | 2 +- 2 files changed, 19 insertions(+), 16 deletions(-) (limited to 'import') diff --git a/import/src/tmdb.rs b/import/src/tmdb.rs index 219c1f6..3d6e832 100644 --- a/import/src/tmdb.rs +++ b/import/src/tmdb.rs @@ -5,7 +5,7 @@ */ use crate::USER_AGENT; use anyhow::{anyhow, bail, Context, Result}; -use jellycache::{cache_memory, cache_store, HashKey}; +use jellycache::{cache_memory, cache_store, EscapeKey, HashKey}; use jellycommon::{ chrono::{format::Parsed, Utc}, Asset, @@ -108,20 +108,23 @@ impl Tmdb { .context("tmdb person images") } pub fn image(&self, path: &str, rt: &Handle) -> Result { - cache_store(format!("ext/tmdb/image/{path}.json"), move || { - rt.block_on(async { - info!("downloading image {path:?}"); - Ok(self - .image_client - .get(format!("https://image.tmdb.org/t/p/original{path}")) - .send() - .await? - .error_for_status()? - .bytes() - .await? - .to_vec()) - }) - }) + cache_store( + format!("ext/tmdb/image/{}.image", EscapeKey(path)), + move || { + rt.block_on(async { + info!("downloading image {path:?}"); + Ok(self + .image_client + .get(format!("https://image.tmdb.org/t/p/original{path}")) + .send() + .await? + .error_for_status()? + .bytes() + .await? + .to_vec()) + }) + }, + ) .context("tmdb image download") .map(Asset) } diff --git a/import/src/trakt.rs b/import/src/trakt.rs index a241725..270c589 100644 --- a/import/src/trakt.rs +++ b/import/src/trakt.rs @@ -101,7 +101,7 @@ impl Trakt { } pub fn show_seasons(&self, id: u64, rt: &Handle) -> Result>> { - cache_memory(&format!("ext/trakt/seasons/{id}"), move || { + cache_memory(&format!("ext/trakt/seasons/{id}.json"), move || { rt.block_on(async { info!("trakt seasons {id:?}"); let url = format!("https://api.trakt.tv/shows/{id}/seasons?extended=full"); -- cgit v1.3