bug: URL-encoded paths will not match stored slugs #95

Closed
opened 2026-05-22 03:29:51 +00:00 by jmiller · 1 comment
Owner

Description

The slug matching in MokoJoomTOS.php compares the URL path (which may be URL-encoded, e.g., %74erms-of-service) against stored slugs (raw strings like terms-of-service). URL-encoded characters will cause valid matches to be missed.

Impact

Edge case but can affect sites with proxies or CDNs that encode URL paths.

Fix

Apply urldecode() to $path before comparison.

Files

  • src/src/Extension/MokoJoomTOS.php:114
## Description The slug matching in `MokoJoomTOS.php` compares the URL path (which may be URL-encoded, e.g., `%74erms-of-service`) against stored slugs (raw strings like `terms-of-service`). URL-encoded characters will cause valid matches to be missed. ## Impact Edge case but can affect sites with proxies or CDNs that encode URL paths. ## Fix Apply `urldecode()` to `$path` before comparison. ## Files - `src/src/Extension/MokoJoomTOS.php:114`
jmiller added the joomlapriority: highbug labels 2026-05-22 03:29:51 +00:00
Author
Owner

Testing Steps -- URL-encoded path matching

Setup

  1. Install plugin, configure slug terms-of-service, set site offline

Test

  1. In an incognito browser, visit yoursite.com/terms-of-service (normal)
  2. Expected: Article content displays
  3. Visit yoursite.com/terms%2Dof%2Dservice (URL-encoded hyphens)
  4. Expected: Article content displays (was previously broken)
  5. Visit yoursite.com/%74erms-of-service (URL-encoded t)
  6. Expected: Article content displays

Pass criteria

  • Normal URLs still work
  • URL-encoded paths now match correctly
## Testing Steps -- URL-encoded path matching ### Setup 1. Install plugin, configure slug `terms-of-service`, set site offline ### Test 1. In an incognito browser, visit `yoursite.com/terms-of-service` (normal) 2. **Expected:** Article content displays 3. Visit `yoursite.com/terms%2Dof%2Dservice` (URL-encoded hyphens) 4. **Expected:** Article content displays (was previously broken) 5. Visit `yoursite.com/%74erms-of-service` (URL-encoded `t`) 6. **Expected:** Article content displays ### Pass criteria - [ ] Normal URLs still work - [ ] URL-encoded paths now match correctly
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: MokoConsulting/MokoJoomTOS#95