Skip to content

Commit 892a4f3

Browse files
committed
Prevent duplicate labels when importing more than 99
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`.
1 parent 9cc15d1 commit 892a4f3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

services/migrations/migrate.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ func migrateRepository(doer *user_model.User, downloader base.Downloader, upload
281281
lbBatchSize = len(labels)
282282
}
283283

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

0 commit comments

Comments
 (0)