Skip to content

Clear stale permalink redirect on slug change#2403

Merged
tf merged 1 commit into
codevise:masterfrom
tf:perma-clash
Apr 23, 2026
Merged

Clear stale permalink redirect on slug change#2403
tf merged 1 commit into
codevise:masterfrom
tf:perma-clash

Conversation

@tf
Copy link
Copy Markdown
Member

@tf tf commented Apr 22, 2026

Previously, updating a permalink's slug or directory could fail with a duplicate-key error on the permalink_redirects unique index. This happened when a prior holder of the same slug had left a redirect behind: if this permalink then took that slug while its entry was still unpublished, the redirect-creation callback was skipped and the old redirect lingered. Once the entry was published and its slug was changed again, inserting the new redirect collided with the zombie.

Cleaning up any existing redirect for the old slug/directory before creating the new one ensures renaming published entries stays reliable, while unpublished slug changes still leave live redirects of other entries untouched.

Previously, updating a permalink's slug or directory could fail with a
duplicate-key error on the permalink_redirects unique index. This
happened when a prior holder of the same slug had left a redirect
behind: if this permalink then took that slug while its entry was
still unpublished, the redirect-creation callback was skipped and the
old redirect lingered. Once the entry was published and its slug was
changed again, inserting the new redirect collided with the zombie.

Cleaning up any existing redirect for the old slug/directory before
creating the new one ensures renaming published entries stays
reliable, while unpublished slug changes still leave live redirects
of other entries untouched.
@tf tf merged commit c341b77 into codevise:master Apr 23, 2026
16 checks passed
@tf tf deleted the perma-clash branch April 23, 2026 06:46
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.

1 participant