PathAlias::preSave() should also trim the path, not just the alias

Created on 3 June 2020, over 4 years ago
Updated 9 January 2024, 12 months ago

Problem/Motivation

URL ending forward slash(‘/‘) breaks url alias(pretty url) paths.

Admin area where users are able to make menu edit changes to menu links e.g. /admin/structure/menu/manage/main seem to break core functionality when appending the forward slash to node references. The following steps will recreate the issue.

Steps to recreate:
1. Visit admin/config/search/path
2. Click on the ‘edit’ operation, assuming there are existing menu links created.
3. Append the path field value with the forward slash character ’/‘. e.g. /node/1 will become /node/1/
4. Save the changes.
5. Visit any page that contains the main menu and you’ll notice the url alias no longer working. The link will now reference the node path with the ‘/‘ prepended.

Proposed resolution

Create a post-update hook in the path_alias module to execute scripts that update aliases in batches, removing trailing spaces and slashes.

🐛 Bug report
Status

Needs work

Version

11.0 🔥

Component
Path 

Last updated 3 days ago

  • Maintained by
  • 🇬🇧United Kingdom @catch
Created by

🇺🇸United States cm0dit

Live updates comments and jobs are added and updated live.
  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

Sign in to follow issues

Merge Requests

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.71.5 2024