Compare commits

...

2 Commits

Author SHA1 Message Date
giles
4d00ba3dbe Fix doubled URLs when |host filter receives absolute URLs
_join_url_parts() only checked the first segment for a scheme, so
passing an already-absolute URL (e.g. from cart_url()) through the
|host filter would join route_prefix() + absolute URL, producing
"https://host/https://host/path/".

Now detects schemes in later segments and resets the base.

Also add missing 'market' entry to _nav.html _app_slugs to match
_nav_oob.html — without it the market menu item fell through to
coop_url('/market/') instead of market_url('/').

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 11:45:35 +00:00
giles
d1621b8e70 Use cart_url/page_cart_url for checkout action instead of url_for
The checkout form action used url_for('cart_global.checkout') which
only resolves inside the cart app. Replace with cart_url() and
page_cart_url() Jinja globals that work across all apps.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 10:22:22 +00:00
3 changed files with 8 additions and 3 deletions

View File

@@ -103,7 +103,7 @@
{% if g.user %}
<form
method="post"
action="{{ url_for('page_cart.page_checkout')|host if page_post is defined and page_post else url_for('cart_global.checkout')|host }}"
action="{{ page_cart_url(page_post.slug, '/checkout/') if page_post is defined and page_post else cart_url('/checkout/') }}"
class="w-full"
>
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">

View File

@@ -1,4 +1,4 @@
{% set _app_slugs = {'cart': cart_url('/')} %}
{% set _app_slugs = {'market': market_url('/'), 'cart': cart_url('/')} %}
<div class="flex flex-col sm:flex-row sm:items-center gap-2 border-r border-stone-200 mr-2 sm:max-w-2xl"
id="menu-items-nav-wrapper">
{% from 'macros/scrolling_menu.html' import scrolling_menu with context %}

View File

@@ -39,7 +39,12 @@ def _join_url_parts(parts: List[str]) -> str:
cleaned = [first.strip("/")]
for seg in parts[1:]:
seg = str(seg)
if seg.startswith("?") or seg.startswith("#"):
# If a later segment is already an absolute URL, use it as the base
m2 = re.match(r"^([a-zA-Z][a-zA-Z0-9+.-]*://)(.*)$", seg)
if m2:
scheme, first = m2.group(1), m2.group(2)
cleaned = [first.strip("/")]
elif seg.startswith("?") or seg.startswith("#"):
cleaned[-1] = cleaned[-1] + seg # attach query/fragment
else:
cleaned.append(seg.strip("/"))