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

Created on 3 June 2020, about 4 years ago
Updated 9 January 2024, 5 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 6 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.69.0 2024