Views contextual filter breaks when query parameter contains slashes

Created on 8 April 2025, 10 days ago

Problem/Motivation

Views contextual filter break the page when value contains slashes if a views data export display is attached to the view page:

Symfony\Component\Routing\Exception\InvalidParameterException: Parameter "arg_0" for route "view.search.data_export_1" must match "[^/]++" ("ABC/000/DE/1234" given) to generate a corresponding URL. in Drupal\Core\Routing\UrlGenerator->doGenerate() (line 209 of core/lib/Drupal/Core/Routing/UrlGenerator.php).

Steps to reproduce

  1. Create a search api solr view page.
  2. Add a "Fulltext search" contextual filter
  3. Add a "Data export" view display and attach it to the view page:
  4. Save the view
  5. Go to the search page and enter search by a keyword with slashes (ie.: ABC/000/DE/1234)
  6. Page will break with the error mentioned above

Proposed resolution

Based on the solution from the issue 3298347 β†’ , the solution is encoding the forwards slashes in the query parameter.

User interface changes

A new option is added to the contextual filter settings to encode slashes in the query parameter:

πŸ› Bug report
Status

Active

Version

10.4 ✨

Component

views.module

Created by

πŸ‡ͺπŸ‡ΈSpain phergo

Live updates comments and jobs are added and updated live.
  • views

    Involves, uses, or integrates with views. In Drupal 8 core, use the β€œVDC” tag instead.

Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024