Problem/Motivation
When an internal URL that contains an array query parameter is entered into a core Link field, those query parameters are duplicated when rendered. For example an entered value of /search?f[0]=test:facet
would be rendered as /search?f[0]=test:facet&f[1]=test:facet
(the characters are decoded for readability).
The value of the URL does not change. This only affects the rendered HTML.
This issue does not seem to affect external URLs.
Steps to reproduce
Here are the steps to reproduce this issue on the vanilla standard profile:
- Add a link field to the Article content type.
- Create a new Article node. In the article's link field enter a value with an internal URL like
/?a[0]=test
. - View the new article node.
Expected result: The rendered link will have an href
attribute containing the URL /?a[0]=test
.
Actual result: The rendered link has an href
attribute containing the URL /?a[0]=test&a[1]=test
.
Of course, the actual URLs will have encoded query strings. Note that if you do not enter a value for the link field's title, then the title will be the correct URL, but the href
will be incorrect.
MRs
MR 5333 is for 11.x
MR 798 can be closed
Proposed resolution
Unset the query
key from the URL options array before rendering.
Remaining tasks
Verify the number of test permutations as mentioned in comment 13.5.- Review
User interface changes
API changes
Data model changes
Original report
Checking D7 Link #2333119: Output broken when using array parameters in query on D8 there are some issues with array query parameters.
- '?a[]=0&b[]=0&b[]=1'
- '?a[0]=0&b[0]=0&b[1]=1',
their link when viewing are rendered (URL encoding removed for readability) with duplicated content.
a[0]=0&a[1]=0&b[0]=0&b[1]=1&b[2]=0&b[3]=1
The title rendering is unreadable including for other tests (which is probably a different issue?)
- '?filter[a][b]=c',
- '?a[b[c]]=d',
![]()