Hi,

I have a problem using Link + Views with the following context :

- The views display an image with "ouput as a link" feature
- In "ouput as a link" I use a Link field
- The link field contains http://mysite.dev/search?f[0]=field_vp_node_eb%253Afield_sp%3A2701

When the view build the content, it passes trough :

- link_field_prepare_view()
- _link_sanitize()
- _link_parse_url()

In _link_parse_url(), the result array is :

$url_parts = array(
    'query' => array(
      'f[0]' => 'field_vp_node_eb%253Afield_sp%3A2701',
    ),
    'url' => 'http://mysite.dev/search',
  );

This is wrong as f[0] is an array and not a simple key.
So then, when it passes trough url(), the characters "[" and "]" are encoded and the url doesn't work anymore.

The correct parsing, as it can be retrieve using drupal_parse_url() should be :

$url_parts = array(
    'query' => array(
      'f' => array(
        0 => 'field_vp_node_eb%253Afield_sp%3A2701',
      ),
    ),
    'url' => 'http://mysite.dev/search',
  );

I think the simplest solution is to replace _link_parse_url() by drupal_parse_url() but I'm not sure of the impact.

CommentFileSizeAuthor
#2 link-fix_parse_url-2891922-2.patch1.15 KBNixou
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Nixou created an issue. See original summary.

Nixou’s picture

Attach is the patch with the drupal_parse_url() solution.