From 97c4e25ba7d68870f5787bbfe367a60309c738af Mon Sep 17 00:00:00 2001 From: giles Date: Sat, 28 Feb 2026 18:47:03 +0000 Subject: [PATCH] Fix post-row link on 404: inject Jinja globals into error context MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit base_context() doesn't include blog_url/cart_url/etc — those live in Jinja globals. Without them call_url(ctx, "blog_url", ...) falls back to a relative path instead of https://blog.rose-ash.com/... Co-Authored-By: Claude Opus 4.6 --- shared/browser/app/errors.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/shared/browser/app/errors.py b/shared/browser/app/errors.py index 379381a..7cb2c3a 100644 --- a/shared/browser/app/errors.py +++ b/shared/browser/app/errors.py @@ -94,6 +94,12 @@ async def _rich_error_page(errnum: str, message: str, image: str | None = None) except Exception: ctx = {"base_title": "Rose Ash", "asset_url": "/static"} + # Inject Jinja globals (blog_url, cart_url, etc.) — these are + # needed by call_url() for cross-subdomain links. + for key, val in current_app.jinja_env.globals.items(): + if key not in ctx: + ctx[key] = val + # Try to fetch fragments, but don't fail if they're unreachable try: from shared.infrastructure.fragments import fetch_fragments