Problem/Motivation
For a views field, enabling Output this field as a link and setting Link path to something like:
my-custom-path?one=[field_value_one]&two=[field_value_two]
Can result in broken links due to handlers/views_handler_field.inc > views_handler_field::render_as_link() not correctly determining the correct $path when the query string has control characters, for example tabs.
This is because parse_url() will replace control characters with _, which isn't considered when $url['query'] is used later on.
Steps to reproduce
- Add a views field with custom link that includes a query string that uses values from other fields
- Other fields have control characters, for example tabs
- Observe link is broken
Proposed resolution
Correctly determine the path.
Current code:
$path = strtr($path, array('?' . $url['query'] => ''));
Possible solution:
$path = strtok($path, '?');
Remaining tasks
- Create patch and test solution
User interface changes
None.
API changes
None.
Data model changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | views-3322498-2.patch | 624 bytes | mustanggb |
Comments
Comment #2
mustanggb commentedAnd a patch.