Link display formatter breaks internal links with brackets in a query string

Created on 14 September 2018, almost 7 years ago
Updated 12 August 2025, 11 days ago

Problem/Motivation

Using a link field with the 'Link' display formatter, internal links with a query string with brackets are broken.

Steps to reproduce

  1. Install Drupal
  2. Add a link field to the article content type
  3. Add an article with an internal link to a view with an exposed filter pre-set, e.g. /resources?tid_1[30]=30
  4. Save and view the article
  5. See the link is rendered as /resources?tid_1%5B0%5D=30&tid_1%5B1%5D=30, which does not work
  6. Update the display to use 'Separate link and text'
  7. View the article again
  8. See the link is rendered as /resources?tid_1%5B30%5D=30, which works

If the link is absolute rather than relative, it also works, e.g. https://google.com/resources?tid_1%5B30%5D=30

Proposed resolution

Remaining tasks

  1. Write a patch with tests
  2. Review

User interface changes

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

N/A

πŸ› Bug report
Status

Closed: duplicate

Version

11.0 πŸ”₯

Component

link.module

Created by

πŸ‡ΊπŸ‡ΈUnited States kruser

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

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