From bb7d0169e04144a126aa2f7ae9b21bbc8e926cd0 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Wed, 29 Apr 2026 18:53:03 +0000 Subject: [PATCH] fix(place): preserve extratags.wikipedia format when has_kiwix_wiki enabled When has_kiwix_wiki is enabled, skip rewriting extratags.wikipedia to a Kiwix content URL. The wiki_url field already provides the correct local Kiwix viewer link for the WikiSummarySection. This preserves the original OSM format (e.g. "en:Title") in extratags.wikipedia so the frontend LINKS section can properly build wikipedia.org URLs. Co-Authored-By: Claude --- lib/place_detail.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/place_detail.py b/lib/place_detail.py index 8bb2330..c2c6845 100644 --- a/lib/place_detail.py +++ b/lib/place_detail.py @@ -290,6 +290,11 @@ def _enrich_wiki_links(result): """ Rewrite wiki-related extratags to local Kiwix URLs where available. Falls back to public URLs. Only runs when has_wiki_rewriting is enabled. + + Note: When has_kiwix_wiki is enabled, we skip rewriting 'wikipedia' since + the wiki_index enrichment provides a proper wiki_url field. This keeps + extratags.wikipedia in the original OSM format for frontend link builders. + Returns the (possibly enriched) result dict. """ try: @@ -298,6 +303,8 @@ def _enrich_wiki_links(result): features = deploy_config.get('features', {}) if not features.get('has_wiki_rewriting', False): return result + # When has_kiwix_wiki is enabled, skip wikipedia rewriting (wiki_url handles it) + has_kiwix_wiki = features.get('has_kiwix_wiki', False) except Exception: return result @@ -313,6 +320,9 @@ def _enrich_wiki_links(result): rewrites = {} for tag in _WIKI_TAGS: + # Skip wikipedia when has_kiwix_wiki is enabled (wiki_url provides the local link) + if tag == 'wikipedia' and has_kiwix_wiki: + continue value = extratags.get(tag) if not value: continue