1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-21 12:44:49 -05:00

Prevent duplicate labels when importing more than 99 (#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`.
This commit is contained in:
Sybren 2023-01-24 20:44:55 +01:00 committed by GitHub
parent b91bc68092
commit 25f4b7d7cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -281,7 +281,7 @@ func migrateRepository(doer *user_model.User, downloader base.Downloader, upload
lbBatchSize = len(labels)
}
if err := uploader.CreateLabels(labels...); err != nil {
if err := uploader.CreateLabels(labels[:lbBatchSize]...); err != nil {
return err
}
labels = labels[lbBatchSize:]