From path containing query is not matched
jonathan_hunt - February 7, 2009 - 10:13
| Project: | Path redirect |
| Version: | 5.x-1.2 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
From path entered as news/?year=2006
Saved in db as news%2F?year=2006 (partial urlencoding occurs in urlpath_redirect_edit_validate()).
When testing, entire incoming path is urlencoded (in path_redirect_init()):
WHERE path = 'news/?year=2006' OR path = 'news%2F%3Fyear%3D2006'
This doesn't match, and the redirect falls through to using 'news' instead.
My workaround is to use the same logic as urlpath_redirect_edit_validate() in path_redirect_init(), adding a third possible match for the db query:
$opt_path = urlencode(preg_replace('/\?.*/', '', $path)) . (strstr($path, '?') ? preg_replace('/.*(\?)/', '$1', $path) : '');
$r = db_fetch_object(db_query("SELECT rid, redirect, query, fragment, type FROM {path_redirect} WHERE path = '%s' OR path = '%s' or path = '%s'", $path, urlencode(utf8_encode($path)), $opt_path));
#1
Can you please try the latest 5.x-1.x-dev version and see if this is fixed for you?
#2
With no response, marking as fixed.
#3
Automatically closed -- issue fixed for 2 weeks with no activity.