"External URLs do not have internal route parameters" exception when site is running in sub folder

Created on 24 March 2023, over 1 year ago
Updated 26 December 2023, 11 months ago

Problem/Motivation

When the Drupal site is running inside of a sub folder, PrettyPathsActiveFilters::getFiltersFromRoute() has a Url::fromUserInput() call, that ends up throwing an UnexpectedValueException "External URLs do not have internal route parameters.".

This is because the url base path is present in what is passed through, and then it's not recognised as an internal route, throwing an exception and stopping pretty paths from working correctly.

Steps to reproduce

Get your Drupal site running inside of a subfolder, ensure facets_pretty_paths is enabled and then go to any Facet with facets_pretty_paths enabled on it and try and use it.

Proposed resolution

Similar to a Patch 🐛 ResourceNotFoundException with ajax facets when site running in subfolder Needs review in the Facets module, inside of Drupal\facets_pretty_paths\PrettyPathsActiveFilters::PrettyPathsActiveFilters(), we need to strip out the base_url from what gets passed through to this call

$route_params = Url::fromUserInput($q)->getRouteParameters();

Remaining tasks

Review patch.

User interface changes

n/a

API changes

n/a

Data model changes

n/a

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom rossb89 Bristol

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

Comments & Activities

Production build 0.71.5 2024