Error with trailing slash if redirect already existis

Created on 21 December 2021, about 3 years ago
Updated 6 August 2024, 5 months ago

Problem/Motivation

When there is already a redirect on the database, but you try to add it with a trailing slash there is a fatal error:

1062 Duplicate entry for key 'hash'

Steps to reproduce

  1. Add a redirect with a trailing slash
  2. Save the redirect
  3. Try to add it again, but ensure it has a trailing slash on the Path
  4. Save it, it will throw the error

Proposed resolution

Add the rtrim($path, '/'); similar to 2932615 - Don't allow adding source paths with trailing slashes, they won't ever work but to the generateHash function on src/Entity/Redirect.php

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇨🇷Costa Rica MauHG

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