Migration: drop too long repo topics (#14152) (#14155)

* Migration: drop to long repo topics

* Update modules/migrations/gitea_uploader.go
This commit is contained in:
6543 2020-12-27 02:57:06 +00:00 committed by GitHub
parent 206b66a184
commit 4a738a8f16
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -154,6 +154,15 @@ func (g *GiteaLocalUploader) Close() {
// CreateTopics creates topics
func (g *GiteaLocalUploader) CreateTopics(topics ...string) error {
// ignore topics to long for the db
c := 0
for i := range topics {
if len(topics[i]) <= 25 {
topics[c] = topics[i]
c++
}
}
topics = topics[:c]
return models.SaveTopics(g.repo.ID, topics...)
}