fix: o namespace routing refinement
Closes #568839 (closed)
Changes
This MR fixes the bug where usernames starting with o. (like o.redka and o.kosatka) were returning 404 errors instead of displaying user profile pages.
Root Cause
The /o route for organizations index was incorrectly matching usernames like o.redka because Rails was interpreting the period (.) as a format separator, treating /o.redka as the /o route with format: 'redka'.
Solution
1. Fixed route definition in config/routes/organizations.rb:
- Added
format: falseconstraint to the/oroute - This prevents Rails from treating periods as format separators
- Ensures the
/oroute only matches exactly/owithout any suffix
2. Added test coverage:
- Test to verify
/o.jsondoes not route to organizations index - Test to verify usernames starting with
o.(likeo.redka) routes to the user profile
Impact
- User profiles for usernames starting with
o.will now correctly route to user profile pages - The
/oorganizations index route continues to work as expected
Edited by Alex Pooley