From 501626fa1d2c15e69d71d18dc2ac2a4774abbf12 Mon Sep 17 00:00:00 2001 From: gilesb Date: Fri, 9 Jan 2026 11:50:59 +0000 Subject: [PATCH] Return recipe media_type from cache endpoint When cache metadata has type "recipe", return that instead of auto-detecting (which returns "unknown" for YAML files). This ensures L2 can properly register recipes as inputs. Co-Authored-By: Claude Opus 4.5 --- server.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server.py b/server.py index 160712e..f186088 100644 --- a/server.py +++ b/server.py @@ -2003,7 +2003,12 @@ async def get_cached(content_hash: str, request: Request): ipfs_cid = cache_item.get("ipfs_cid") if cache_item else None file_size = cache_path.stat().st_size - media_type = detect_media_type(cache_path) + # Use stored type from metadata, fall back to auto-detection + stored_type = meta.get("type") if meta else None + if stored_type == "recipe": + media_type = "recipe" + else: + media_type = detect_media_type(cache_path) logger.info(f"get_cached: JSON response, ipfs_cid={ipfs_cid[:16] if ipfs_cid else 'None'}..., took {time.time()-start:.3f}s") return { "content_hash": content_hash,