Query string parameters token replacement broken when configured param is empty

Created on 5 June 2019, about 5 years ago
Updated 25 April 2024, about 2 months ago

Problem/Motivation

#1442960: Query string parameters token replacements added the ability to use query string parameters from the current request to replace tokens in fields using the "render as link" feature. The original patch made sure that query string parameters were removed from the generated URL when the corresponding parameters in the current request URL where missing or empty. This no longer happens in D8, so the /node/[nid]?page={{ arguments.page }} pattern is translated to /node/1?page= on when the current URL is /node/1. This among the rest breaks active URL handling.

Steps to reproduce

  1. Create a View of nodes
  2. Show fields
  3. Show the nid and title field
  4. Add a contextual filter 'Content: Has taxonomy term ID' and set default value to ' Display all results for the specified field'
  5. For the title field set rewrite results: Output this field as a custom link to /node/{{ nid }}?term_id={{ arguments.tid }}
  6. Create a page display
  7. Go to the page and see that 'term_id' is added to the link URL on the title, bt with no value
  8. Didn't try the patch yet

Proposed resolution

Restore the original behavior and remove configured parameters when they are empty.

Remaining tasks

  • Validate the proposed solution
  • Add test coverage
  • Reviews

User interface changes

None

API changes

None

Data model changes

None

Release notes snippet

None

🐛 Bug report
Status

Needs work

Version

11.0 🔥

Component
Views 

Last updated 28 minutes ago

Created by

🇮🇹Italy plach Venezia

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.

  • 🇺🇸United States smustgrave

    This issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge request as a guide.

    Moving to PNMI for steps to reproduce per #8

  • Status changed to Needs work about 2 months ago
  • 🇳🇱Netherlands Lendude Amsterdam

    Steps to reproduce:
    * Create a View of nodes
    * Show fields
    * Show the nid and title field
    * Add a contextual filter 'Content: Has taxonomy term ID' and set default value to ' Display all results for the specified field'
    * For the title field set rewrite results: Output this field as a custom link to /node/{{ nid }}?term_id={{ arguments.tid }}
    * Create a page display
    * Go to the page and see that 'term_id' is added to the link URL on the title, bt with no value

    Didn't try the patch yet

Production build 0.69.0 2024