Skip to content

fix(plugin-redirects): make 'from' field unique to prevent errors in redirect logic #12964

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 7, 2025

Conversation

jessrynkar
Copy link
Member

@jessrynkar jessrynkar commented Jun 27, 2025

What?

This PR updates the from field in plugin-redirects to add unique: true.

Why?

If you create multiple redirects with the same from URL — the application won't know which one to follow, which causes errors and unpredictable behavior.

How?

Adds unique: true to the plugin injected from field.

Migration Required

This change will require a migration. Projects already using this plugin will need to:

  • Ensure there are no duplicate from values in their existing redirects collection.
  • Remove or modify any duplicate entries before applying this update.

Fixes #12959

@jacobsfletch jacobsfletch changed the title chore(plugin-redirects): make 'from' field unique to prevent errors in redirect logic fix(plugin-redirects): make 'from' field unique to prevent errors in redirect logic Jul 2, 2025
Copy link
Contributor

@DanRibbens DanRibbens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding unique to a field will require a migration. I think it is fine as long as we document it in the PR description and then also we will need to edit the release notes to include the extra instruction also.

If a project already has non-unique records, duplicates will need to be updated prior to adding the unique constraint.

@jessrynkar jessrynkar merged commit 50c2f8b into main Jul 7, 2025
617 of 632 checks passed
@jessrynkar jessrynkar deleted the fix/plugin-redirect-from-field branch July 7, 2025 10:21
Copy link
Contributor

github-actions bot commented Jul 7, 2025

🚀 This is included in version v3.46.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Redirection plugin from field should be unique
3 participants