diff options
| author | ivar <i@oiee.no> | 2026-04-04 16:12:29 +0200 |
|---|---|---|
| committer | ivar <i@oiee.no> | 2026-04-04 16:12:29 +0200 |
| commit | 8b137242305bb2a39f580d994392ece195aacf3b (patch) | |
| tree | acb6ddd6173ee5adc51f2d1bda046fc1dcb49c11 /internal | |
| parent | f045a49e6feb6f448faea073821a9661f8b710a3 (diff) | |
| download | nebbet.no-8b137242305bb2a39f580d994392ece195aacf3b.tar.xz nebbet.no-8b137242305bb2a39f580d994392ece195aacf3b.zip | |
fix: guard RenamePost against self-rename (noop)
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/db/posts.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/internal/db/posts.go b/internal/db/posts.go index d391c3e..c1360ab 100644 --- a/internal/db/posts.go +++ b/internal/db/posts.go @@ -141,6 +141,9 @@ func (m *MetaDB) CollapseRedirects(oldSlug, newSlug string) error { // RenamePost atomically renames a post from oldSlug to newSlug, // updates any existing redirect chains, and adds a redirect from oldSlug to newSlug. func (m *MetaDB) RenamePost(oldSlug, newSlug string) error { + if oldSlug == newSlug { + return nil + } tx, err := m.db.Begin() if err != nil { return err |
