From d5051c97e4000ddf9bd95a11cfc506c774c7ca85 Mon Sep 17 00:00:00 2001 From: kolaente Date: Wed, 8 Apr 2026 10:25:54 +0200 Subject: [PATCH] fix(background): use targeted column update when removing background Fixes #2552. RemoveProjectBackground was passing a minimal Project struct (only ID set) through UpdateProject, which always includes 'title' in its Cols() list. This caused XORM to write the zero-value empty title to the DB, wiping the real project title. Now uses ClearProjectBackground which only updates background_file_id and background_blur_hash. --- pkg/modules/background/handler/background.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/pkg/modules/background/handler/background.go b/pkg/modules/background/handler/background.go index f7f007412..a89784ee9 100644 --- a/pkg/modules/background/handler/background.go +++ b/pkg/modules/background/handler/background.go @@ -443,7 +443,7 @@ func RemoveProjectBackground(c *echo.Context) error { s := db.NewSession() defer s.Close() - project, auth, err := checkProjectBackgroundWritePermissions(s, c) + project, _, err := checkProjectBackgroundWritePermissions(s, c) if err != nil { _ = s.Rollback() return err @@ -455,10 +455,7 @@ func RemoveProjectBackground(c *echo.Context) error { return err } - project.BackgroundFileID = 0 - project.BackgroundInformation = nil - project.BackgroundBlurHash = "" - err = models.UpdateProject(s, project, auth, true) + err = models.ClearProjectBackground(s, project.ID) if err != nil { _ = s.Rollback() return err