Closed (duplicate)
Project:
Path redirect
Version:
5.x-1.2
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
19 Feb 2009 at 12:13 UTC
Updated:
24 Feb 2009 at 02:34 UTC
path_redirect.module
string 39 - 42
if (!$r) {
$path = preg_replace('/\?.*/', '', $path);
$r = db_fetch_object(db_query("SELECT rid, redirect, query, fragment, type FROM {path_redirect} WHERE path = '%s' OR path = '%s'", $path, urlencode(utf8_encode($path))));
}
Should be:
if (!$r) {
$path_2 = preg_replace('/\?.*/', '', $path);
if($path_2 != $path) {
$r = db_fetch_object(db_query("SELECT rid, redirect, query, fragment, type FROM {path_redirect} WHERE path = '%s' OR path = '%s'", $path_2, urlencode(utf8_encode($path_2))));
}
}
Every page witch has no redirect hits database two times.
This fix it.
Comments
Comment #1
dave reidDuplicate of the path check rewrite I'm working on in #368377: Rewrite path matching code.