I have a http_response variant for node_view handler that has a redirect destination with a token querystring:
node/%node:nid?%token:global-thingy
So %token:global-thingy is a valid querystring in some cases and things work fine, but in other cases it's an empty string. This results in a Location header like "http://www.example.com/node/4048%3F".
In page_manager_http_response_render() I was at first not sure why strtr() is used. Why not just set $info['destination'] to $url['path']? Then I realized it's not that simple; $path could have started out as an absolute URL. So, ultimately it's whatever code passes the destination of 'node/nid?' to drupal_get_path_alias() that barfs. Can/should we just remove a trailing empty querystring?
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | ctools-1256878-http_response_render_query_string-D7.patch | 1.32 KB | mstrelan |
| #2 | ctools-1256878-http_response_render_query_string-D6.patch | 530 bytes | mstrelan |
| #2 | ctools-1256878-http_response_render_query_string-D6-2.patch | 1009 bytes | mstrelan |
Comments
Comment #1
mstrelan commentedIt seems to me in D7 that http response code pages can't handle a query string at all for internal URLs. I get the following message
This is because
ctools_context_handler_render_handler()passes$options['query']todrupal_goto()as a string rather than an array of key to value pairs.Comment #2
mstrelan commentedThree patches attached.
The first is a patch for D7 that fixes the format of query strings (i.e string to array) if they are present and trims empty query strings so the url() function doesn't
decodeencode the question mark.The second is for D6 and simply trims empty query strings and finally the third is also for D6 but keeps the format for query strings consistent (ie. an array rather than string).
Comment #3
merlinofchaos commentedCommitted the 7.x version. Leaving this NR for the 6.x version which is unfortunately lower priority for me right now.
Comment #6
japerryD6 version looks good. Fixed!