Query string duplications

Created on 12 June 2017, over 7 years ago
Updated 20 June 2024, 6 months ago

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:

  1. Add a link field to the Article content type.
  2. Create a new Article node. In the article's link field enter a value with an internal URL like /?a[0]=test.
  3. 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

  1. 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',

🐛 Bug report
Status

Fixed

Version

10.2

Component
Link 

Last updated about 3 hours ago

Created by

🇳🇱Netherlands clemens.tolboom Groningen, 🇳🇱/🇪🇺

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024