Iframe module generates URL with invalid query string.

I am using following type of URL for the iframe
http://mydomain/content/phplist/?p=preferences&uid=b003b98749ba21ed87e32cf262ed03b4
The iframe module will encoded it, & becomes &, resulting in url:
http://mydomain/content/phplist/?p=preferences&uid=b003b98749ba21ed87e32cf262ed03b4

This is invalid. The PHP $_GET variable in the script opened in the iframe will not recognise "uid" as an attribute, instead it asumes "amp;uid" as being te attribute. There must not be any htmlentities (&) in the src url for an iframe.

My solution:
In iframe.module, at line 801, remove the check_url function.
So:

'<iframe src="' . check_url(url($path, $options)) . '"' . drupal_attributes($options['attributes']) .

Becomes:

'<iframe src="' . url($path, $options) . '"' . drupal_attributes($options['attributes']) .

The same goes for the link created in case a browser does not support iframes. Here html entities are alowed, but the l() function already uses check_url(), so when using check_url() again as parameter for the l() function creates a double-encoding which is not valid. Also here remove check_url().
My solution:
In iframe.module, at line 804, remove the check_url function.
So:

    t('Your browser does not support iframes. But You can use the following link.') . ' ' . l('Link', check_url(url($path, $options)), $optionsLink) . '</iframe>';

Becomes

    t('Your browser does not support iframes. But You can use the following link.') . ' ' . l('Link', url($path, $options), $optionsLink) . '</iframe>';

Comments

neffets’s picture

Assigned: Unassigned » neffets

No and Yes.

no: The uri in the iframe src attribute has to be valid html, so the ampersand has to be encoded.
==> there the check_url function is correct.

yes: In the alternate part its double encoded. Confirmed.
==> will change it to "l"-function alone, in the next release.

hovel’s picture

You are absolutely right. My fault.

neffets’s picture

Status: Active » Fixed

Fixed in next release

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

neffets’s picture

fixed in revision 6.x-1.7

gilmorelou’s picture

Title: IFRAME must not encode URL or LINK » IFRAME invalid url
Assigned: neffets » gilmorelou
Category: bug » support
Priority: Normal » Major
Status: Closed (fixed) » Needs review

HI, I 'm not sure I understand this....I need my iframe url to be:

http://www.signaturetravelnetwork.com/utils/landSearch/index.cfm?agency_id= 1580&utp=consumer&type=consumer

(at least that's what they gave us...)
and it gives me an error until I get rid of everything after the ? (including the ?)....
I need to have the agency id in there - this is a travel agent....
How can I get this to work?
thanks!

neffets’s picture

Status: Needs review » Closed (works as designed)

Remove the SPACE between "agency_id=" and the "1580", then it will be valid

neffets’s picture

Status: Closed (works as designed) » Closed (fixed)