Support case-sensitive redirects

Created on 9 January 2019, over 5 years ago
Updated 12 August 2024, 26 days ago

The Drupal 8 port does not support case sensitive redirects like the Drupal 7 module did. See #889492: Support case-sensitive redirects β†’ . In the d8 module, if you have two source URLs identical except in their case, the hash will be identical, resulting in an Integrity constraint violation when saving the second redirect.

πŸ› Bug report
Status

Needs work

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States q0rban Atlanta, GA

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

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 5.7
    last update 9 months ago
    63 pass
  • First commit to issue fork.
  • Pipeline finished with Success
    2 months ago
    Total: 270s
    #208061
  • Pipeline finished with Success
    2 months ago
    Total: 278s
    #208108
  • πŸ‡ΊπŸ‡ΈUnited States weekbeforenext Asheville, NC

    This functionality seemed to be important enough to be included in the main module. My site doesn't use the redirect_domain sub module, so I created MR !102 working towards a main module solution.

    Next steps:

    1. Manual testing
    2. Review/fix pipeline issues
    3. Write tests

    I opted to set the new config value to false if the module is newly installed, but to true if the module is being updated. This is because a site could have mixed-case aliases and redirects and I don't want it to break functionality. I guess this isn't completely foolproof because a site can have aliases before enabling this module.

    Thinking "out loud"

    An additional feature when toggling the case-sensitivity off or updating the module might be to check if the site does have mixed-case URLs and provide a log message. We could provide a validation error that doesn't allow the user to toggle the option off if there are paths that would be affected. Maybe a batch update feature, if one doesn't already exist.

  • Pipeline finished with Success
    2 months ago
    Total: 187s
    #208917
  • Status changed to Needs review 2 months ago
  • πŸ‡ΊπŸ‡ΈUnited States weekbeforenext Asheville, NC

    Made some updates to the update hook because it's not working on my site, but also continues to not work on my site.

    The original issue I experienced was an alias was changed, only capitalizing some letters. When this happened, a redirect was created from a completely lowercase version to a mixed-case version and caused a redirect loop.

    Aside from the update hook not setting the new config value, my updates do allow for toggling between allowing mixed-case URLs in redirects and aliases and working only with lower case URLs.

    Notes

    In thinking about possible validation and checking if there are already aliases or redirects with mixed-case, a query like this seems to work:

    select * from path_alias where alias regexp binary '[A-Z]';

    I would like some input on the direction I'm heading before I add more functionality and tests.

  • Status changed to Needs work 29 days ago
  • πŸ‡¨πŸ‡­Switzerland Berdir Switzerland

    What's the use case for this?

    I've just merged πŸ“Œ Public method Redirect::generateHash() should unify path before generating the hash Active which would need to be adjusted for this as well.

  • πŸ‡ΊπŸ‡ΈUnited States weekbeforenext Asheville, NC

    New config to indicate whether the site allows mixed-case paths or lowercase only. Based on that indicator, we ensure redirects aren't created that cause redirect loops. I think a similar functionality was available in the Drupal 7 version, so I went this route.

    I don't know the history of not including it for D8+, so happy to pivot to another path that protects us against redirect loops.

Production build 0.71.5 2024