Index: includes/path.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/path.inc,v retrieving revision 1.60 diff -u -r1.60 path.inc --- includes/path.inc 10 Mar 2010 19:36:14 -0000 1.60 +++ includes/path.inc 28 Mar 2010 06:35:47 -0000 @@ -73,12 +73,19 @@ $path_language = $path_language ? $path_language : $language_content->language; - if ($action == 'wipe') { + if ($action === 'wipe') { $cache = array(); $cache['whitelist'] = drupal_path_alias_whitelist_rebuild(); } elseif ($cache['whitelist'] && $path != '') { - if ($action == 'alias') { + if (preg_match('/([^#]*)(#.*)/', $path, $matches)) { + $path = $matches[1]; + $anchor = $matches[2]; + } + else { + $anchor = ''; + } + if ($action === 'alias') { // During the first call to drupal_lookup_path() per language, load the // expected system paths for the page from cache. if (!empty($cache['first_call'])) { @@ -103,7 +110,7 @@ } // If the alias has already been loaded, return it. if (isset($cache['map'][$path_language][$path])) { - return $cache['map'][$path_language][$path]; + return $cache['map'][$path_language][$path] . $anchor; } // Check the path whitelist, if the top_level part before the first / // is not in the list, then there is no need to do anything further, @@ -112,7 +119,7 @@ return FALSE; } // For system paths which were not cached, query aliases individually. - else if (!isset($cache['no_aliases'][$path_language][$path])) { + elseif (!isset($cache['no_aliases'][$path_language][$path])) { // Get the most fitting result falling back with alias without language $alias = db_query("SELECT alias FROM {url_alias} WHERE source = :source AND language IN (:language, :language_none) ORDER BY language DESC, pid DESC", array( ':source' => $path, @@ -120,7 +127,7 @@ ':language_none' => LANGUAGE_NONE, ))->fetchField(); $cache['map'][$path_language][$path] = $alias; - return $alias; + return $alias . $anchor; } } // Check $no_source for this $path in case we've already determined that there @@ -144,7 +151,7 @@ $cache['no_source'][$path_language][$path] = TRUE; } } - return $source; + return $source . $anchor; } }