Files
orion/app
Samir Boulahtit 05fa3647e5 fix: correct base_url calculation in error renderer for path-based routing
Fix error page links not respecting vendor context in path-based routing
by aligning with the pattern used throughout the codebase.

Problem:
- Error pages showed links like /shop/ instead of /vendors/wizamart/shop/
- error_renderer.py was checking request.state.access_method (never set)
- This meant access_method was always None, so base_url defaulted to "/"
- Links ignored vendor context and broke multi-access routing

Root Cause:
- Inconsistent pattern: error_renderer.py used wrong attribute
- Rest of codebase (6 locations) correctly uses vendor_context.get('detection_method')
- No code ever sets request.state.access_method anywhere

Solution:
- Change from: access_method = getattr(request.state, "access_method", None)
- Change to: access_method = vendor_context.get('detection_method', 'unknown')
- Aligns with pattern used in:
  * app/exceptions/handler.py:384 (login redirect)
  * main.py:336 (root redirect)
  * app/routes/shop_pages.py:85, 391 (shop pages)
  * app/api/v1/shop/auth.py:159, 223 (auth endpoints)

Changes:
- Line 263-264: Get vendor_context first, then extract detection_method from it
- Line 266: Now correctly detects path-based access method
- base_url now properly set to /vendors/wizamart/ for path-based routing

Impact:
-  Path-based routing: /vendors/wizamart/shop123 → links to /vendors/wizamart/shop/
-  Direct shop access: /shop/test → links to /shop/ (unchanged)
-  No breaking changes (access_method was never used before)
-  Consistent with entire codebase pattern

Testing:
- curl http://localhost:8000/vendors/wizamart/shop123
  Before: href="/shop/" (wrong)
  After: href="/vendors/wizamart/shop/" (correct)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-25 21:22:28 +01:00
..
2025-11-15 20:57:39 +01:00
2025-11-10 19:42:41 +01:00