I'm having trouble linking to a URL in my menu, and have narrowed the problem down to an "&" in the URL which is part of a query.

The first problem is that any Path with an "&" has base_url prefixed. The second is that the query isn't handling "%26" properly.

I'll try to explain it as if I'm editing a menu item in the admin pages:

Edit Menu Item

Title:
Blah

Description:
Just trying to make this clear

Path:*
http://www.blah.com/?request=hello&1663

etc...

shows up on my primary menu links as

http://192.111.19.24/drupal/http://www.blah.com/?request=hello&1663
(192.111.19.24/drupal being my base address)

Replacing the "&" with "%26" fixes Drupal's problem, but the query refuses to recognize "%26" as an "&" character so the link doesn't work

ie:

Path:*
http://www.blah.com/?request=hello%261663

shows up as "http://www.blah.com/?request=hello&1663" (no base_url prefixed) in my Drupal menu, but when I follow the link it shows up as "...%261663" , and the page returns an error because of this

Too much info? Too little? Please let me know if you have any suggestions or need clarification.
I don't mind editing the menu.inc file, if that could somehow fix things, but have no idea what to add or remove.

Thanks in advance...

Comments

satori1984’s picture

Haven't tested it myself, but you might try escaping the ampersand with a backslash.

i.e.
http://www.example.com/?q=first_param&q2=second_param
becomes
http://www.example.com/?q=first_param\&q2=second_param

Could you drop a note if it works?

Fluence’s picture

I tried the backslash and it didn't work.
It seems that if the ampersand "&" is there at all, Drupal will add the base_url.

Is there some way to force "%26" to be properly recognized by the query?

Fluence’s picture

I am using URL aliases, if that might make a difference.

If I disable the URL aliases module, are all of my aliases deleted, or if I reenable the module will they reappear? (can I safely test disabling URL aliases?...)

Thanks

Follow-up:
I still have an installation of Drupal 4.6 installed on my system, without URL aliases installed. I tried the URL with the "&" and it has the same issue.

So, it's neither URL aliases nor specific to Drupal 4.7.0 (my current version)

Fluence’s picture

I've tried using &
Drupal does not prefix the base_url with & , but it still shows up in the query as &, so it's still not working.

Anyone with a suggestion that might work?

Steven’s picture

There was a bug related to this fixed in the latest RC. Make sure you're not using an older 4.7 beta. External URLs in menu items are not supported in 4.6.x though.

It works for me locally at least on the latest development version.

--
If you have a problem, please search before posting a question.

Fluence’s picture

I'm currently using 4.7.0 beta 5. I'll try 4.7 RC 1
I'll post the results in a bit...

Thanks!

Fluence’s picture

It worked!

I've upgraded to 4.7.0 RC1 and the & works just fine now.

Thanks!!