--- path_redirect.module 2007-10-06 20:33:20.672026250 -0500
+++ path_redirect.module.new 2007-10-06 20:38:21.726841000 -0500
@@ -25,7 +25,12 @@ function path_redirect_help($section) {
function path_redirect_init() {
// check through the redirects
// see if this page is one of those
- $path = db_escape_string($_GET['q']);
+ $path = urldecode(trim($_SERVER['REQUEST_URI'], '/'));
+ if(preg_match('/^?q=/', $path) {
+ // Reformat URL and query string if this is not a clean URL
+ $path = preg_replace(array('/^?q=/', '/&/'), array('', '?'), $path, 1);
+ }
+ $path = drupal_get_normal_path($path);
$r = db_fetch_object(db_query("SELECT redirect, query, fragment, type FROM {path_redirect} WHERE path = '%s'", $path));
if ($r) {
drupal_goto($r->redirect, ($r->query ? $r->query: NULL), ($r->fragment ? $r->fragment : NULL), $r->type);
@@ -248,9 +253,6 @@ function path_redirect_edit_validate($fo
elseif (strstr($form_values['path'], '#')) {
form_set_error('path', t('You cannot redirect from a fragment anchor.'));
}
- elseif (strstr($form_values['path'], '?')) {
- form_set_error('path', t('You cannot currently include a query in your redirect from path.'));
- }
elseif (!valid_url($form_values['path'])) {
form_set_error('path', t('The redirect from path does not appear valid. This must be a local Drupal path.'));
}