Entity paths override paths from routing.yml

Created on 14 February 2025, about 2 months ago

Problem/Motivation

When a user creates a new entity and assigns a custom path (e.g., /admin/modules), the entity's path will override the corresponding path defined in routing.yml.

Steps to Reproduce

  1. Create a new entity or edit an existing one.
  2. Manually add a URL alias that matches a path in routing.yml (e.g., /admin/modules).
  3. Save the entity.
  4. Navigate to the modules list page (usually found at /admin/modules).

As a result: You will not see the modules list. Instead, the node will be displayed at that path.

Proposed Resolution

Create a constraint with the message: "This URL is used in routing.yml. Please try another one."

or

Automatically add a suffix, such as /admin/modules-0, to the alias.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Active

Version

11.1 πŸ”₯

Component

other

Created by

πŸ‡ΊπŸ‡¦Ukraine s.kostiukevych Lutsk

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

Comments & Activities

  • Issue created by @s.kostiukevych
  • I was able to reproduce this from the standard installation profile by creating a new basic page with the alias /node/1/edit. Once saved, it is impossible to edit the node again. The only workaround is to visit /node/1/delete, which would cause any other field data to be lost.

    I think there's a case that this could be labelled a bug because it can:

    • Cause a significant admin- or developer-facing bug with no workaround.
    • Cause user input to be lost, but do not delete or corrupt existing data.

    However, this has clearly been possible for a very long time, so feels fair.

    Create a constraint with the message: "This URL is used in routing.yml. Please try another one."

    or

    Automatically add a suffix, such as /admin/modules-0, to the alias.

    In my opinion, it's better to reject the path alias rather than silently change it. However, I'm not sure we should explain that the problem is that the URL is in a routing.yml file. That's not always going to be true. For example, /node/1/edit the ContentEntityType annotation in Node.php.

    What do you think of a more generic message like ?

  • πŸ‡³πŸ‡ΏNew Zealand quietone

    Changes are made on on 11.x (our main development branch) first, and are then back ported as needed according to the Core change policies β†’ .

  • πŸ‡¨πŸ‡­Switzerland berdir Switzerland

    This is a duplicate of πŸ“Œ Do not allow existing or reserved paths as aliases Needs work .

Production build 0.71.5 2024