Steps to reproduce:

  1. Create a node containing a named anchor (e.g. <a name='top'></a>)
  2. Create a menu item with a relative URL and the named anchor (e.g. node/1#top)
  3. Browse to a page that contains the menu link and click it.
  4. The correct page will load, but the browser does not scroll to the anchor.
  5. The URL in the title bar (and in the page source) contains %23 where there should be a #.

The # character in the URL should not be encoded. I'd guess that somewhere in the code, there is an indirect call to urlencode() that doesn't account for the possibility of a named anchor in the menu item URL.

CommentFileSizeAuthor
#3 common.inc_26.patch439 bytesCreazion
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

subakva’s picture

See this support request for another example of someone with the same problem.

You can use an absolute URL to workaround for this problem.

Creazion’s picture

Hi,

there is a solution for the problem.

The drupal_urlencode function should look like this:

function drupal_urlencode($text) {
  $search  = array('%2F','%23');
  $replace = array('/','#');
  return str_replace($search, $replace, urlencode($text));
}

instead of this:

function drupal_urlencode($text) {
  return str_replace('%2F', '/', urlencode($text));
}
Creazion’s picture

Status: Active » Reviewed & tested by the community
FileSize
439 bytes

Here is the patch for my solution. Hope it will help.

drumm’s picture

Status: Reviewed & tested by the community » Closed (duplicate)
NaX’s picture

look here for possible menu system patch http://drupal.org/node/90570