Invalid token "The user-entered string '' must begin with a '/', '?', or '#'."

Created on 22 November 2022, over 1 year ago
Updated 3 October 2023, 9 months ago

Problem/Motivation

When a token does NOT exist, then `Url::fromUserInput` tries to generate the URL by using the token, it throws:

The user-entered string '' must begin with a '/', '?', or '#'.

Steps to reproduce

Add a token that does NOT apply, for example, a node without parent-parent within the menu system:
[node:menu-link:parent:parent:url]

Proposed resolution

Add an extra parameter to the token manager in order to clear the text when a token replacement is NOT found.
['clear' => TRUE] then we can confirm the Url is NOT empty before using the `Url::fromUserInput` method.

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡¨πŸ‡·Costa Rica keboca

Live updates comments and jobs are added and updated live.
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.69.0 2024