From c077a084d7bac8acc1bd247b2bd3d60835a17ded Mon Sep 17 00:00:00 2001 From: Nanguan Lin <70063547+lng2020@users.noreply.github.com> Date: Sun, 12 Nov 2023 20:31:03 +0800 Subject: [PATCH] Fix wrong xorm Delete usage(backport for 1.20) (#28003) manually backport for https://github.com/go-gitea/gitea/pull/27995 The conflict is `ctx` and `db.Defaultctx`. --- models/auth/source.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/auth/source.go b/models/auth/source.go index 0a904b777..6fdd2006f 100644 --- a/models/auth/source.go +++ b/models/auth/source.go @@ -232,7 +232,7 @@ func CreateSource(source *Source) error { err = registerableSource.RegisterSource() if err != nil { // remove the AuthSource in case of errors while registering configuration - if _, err := db.GetEngine(db.DefaultContext).Delete(source); err != nil { + if _, err := db.GetEngine(db.DefaultContext).ID(source.ID).Delete(new(Source)); err != nil { log.Error("CreateSource: Error while wrapOpenIDConnectInitializeError: %v", err) } }