From cbebcc1c26bdc57966023bf51dd75d80be4c5beb Mon Sep 17 00:00:00 2001 From: techknowlogick Date: Sun, 2 Oct 2022 17:43:30 -0400 Subject: [PATCH] Foreign ID conflicts if ID is 0 for each item (#21271) (#21272) The default is 0 if not defined, and that causes dupe index errors Backport of #21271 --- services/migrations/gitea_uploader.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/migrations/gitea_uploader.go b/services/migrations/gitea_uploader.go index 21f587604952f..be949559d4d32 100644 --- a/services/migrations/gitea_uploader.go +++ b/services/migrations/gitea_uploader.go @@ -412,6 +412,10 @@ func (g *GiteaLocalUploader) CreateIssues(issues ...*base.Issue) error { }, } + if is.ForeignReference.ForeignIndex == "0" { + is.ForeignReference.ForeignIndex = strconv.FormatInt(is.Index, 10) + } + if err := g.remapUser(issue, &is); err != nil { return err }