Should check if URL is routed before calling getRouteName

Created on 13 August 2025, about 2 months ago

Problem/Motivation

I want to redirect to a PDF file.

However in FieldRedirectionFormatter::shouldDeny() getRouteName() is called on the $redirect_url resulting in an UnexpectedValueException.

Steps to reproduce

Try to redirect to a pdf.

Proposed resolution

Only call getRouteName if url is routed. E.g.

$route_name = $redirect_url->isRouted() ? $redirect_url->getRouteName() : NULL;

🐛 Bug report
Status

Active

Version

2.3

Component

Code

Created by

🇬🇧United Kingdom dahousecat

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024