Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f204ff4

Browse files
yardenshohamdrsybren
andauthoredJan 24, 2023
Prevent duplicate labels when importing more than 99 (#22591) (#22598)
Backport #22591 Importing labels (via `gitea restore-repo`) did not split them up into batches properly. The first "batch" would create all labels, the second "batch" would create all labels except those in the first "batch", etc. This meant that when importing more than 99 labels (the batch size) there would always be duplicate ones. This is solved by actually passing `labels[:lbBatchSize]` to the `CreateLabels()` function, instead of the entire list `labels`. Co-authored-by: Sybren <[email protected]>
1 parent f6cb786 commit f204ff4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎services/migrations/migrate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ func migrateRepository(doer *user_model.User, downloader base.Downloader, upload
282282
lbBatchSize = len(labels)
283283
}
284284

285-
if err := uploader.CreateLabels(labels...); err != nil {
285+
if err := uploader.CreateLabels(labels[:lbBatchSize]...); err != nil {
286286
return err
287287
}
288288
labels = labels[lbBatchSize:]

0 commit comments

Comments
 (0)
Please sign in to comment.