From b250d0c25777f2467f792762dbc32485e0c1cb97 Mon Sep 17 00:00:00 2001 From: Matt Date: Sat, 18 Apr 2026 00:06:52 +0000 Subject: [PATCH] Fix Kiwix download URL generation in embedder - Add /content/ prefix to wiki.echo6.co URLs (required by kiwix-serve) - Stop stripping ZIM flavor/date suffix (e.g. _maxi_2025-11) from filename - Use str.removesuffix instead of regex to strip only .zim extension Before: https://wiki.echo6.co/appropedia_en_all/Article After: https://wiki.echo6.co/content/appropedia_en_all_maxi_2025-11/Article Co-Authored-By: Claude Opus 4.6 --- lib/embedder.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/embedder.py b/lib/embedder.py index 034624a..8dcc45a 100644 --- a/lib/embedder.py +++ b/lib/embedder.py @@ -296,11 +296,11 @@ def embed_single(file_hash, db, config): from urllib.parse import quote as url_quote zim_name = meta.get('zim_name', '') if not zim_name: - # Derive from zim_file: strip flavor/date suffix + # Derive from zim_file: strip only .zim extension, keep full name zf = meta.get('zim_file', '') - zim_name = re.sub(r'_(?:maxi|mini|nopic)_[\d-]+\.zim$', '', zf) + zim_name = zf.removesuffix('.zim') article_path = url_quote(meta['article_path'], safe='/:@!$&()*+,;=-._~') - download_url = f'https://wiki.echo6.co/{zim_name}/{article_path}' + download_url = f'https://wiki.echo6.co/content/{zim_name}/{article_path}' elif doc.get('path'): download_url = generate_download_url( doc['path'], config.get('library_root', '/mnt/library')