From efced60c357213ef52eb09c8d4e96ecc5988bcf6 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sun, 22 Mar 2026 14:20:35 -0400 Subject: [PATCH] Serve raw files (images, etc.) from data directory in catch-all Co-Authored-By: Claude Opus 4.6 (1M context) --- engine.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/engine.py b/engine.py index 81fd06a..085fffd 100644 --- a/engine.py +++ b/engine.py @@ -1117,6 +1117,12 @@ async def catch_all(req, resp, *, path): file_path = DATA_DIR / f"{path}.md" dir_path = DATA_DIR / path index_path = dir_path / "index.md" + raw_path = DATA_DIR / path + + # Serve raw files (images, etc.) directly from data directory + if raw_path.exists() and raw_path.is_file() and not path.endswith(".md"): + resp.file(str(raw_path)) + return # Serve markdown file if file_path.exists():