mirror of
https://github.com/zvx-echo6/recon.git
synced 2026-05-20 06:34:40 +02:00
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 <noreply@anthropic.com>
This commit is contained in:
parent
a40ce47127
commit
b250d0c257
1 changed files with 3 additions and 3 deletions
|
|
@ -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')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue