]> source.dussan.org Git - gitea.git/commitdiff
Migration: drop too long repo topics (#14152) (#14155)
author6543 <6543@obermui.de>
Sun, 27 Dec 2020 02:57:06 +0000 (02:57 +0000)
committerGitHub <noreply@github.com>
Sun, 27 Dec 2020 02:57:06 +0000 (21:57 -0500)
* Migration: drop to long repo topics

* Update modules/migrations/gitea_uploader.go

modules/migrations/gitea_uploader.go

index 2cb19685fcb9efb74027677aab905e2e367041e4..334ddad54f1d4dd3af166b2cb7837218d9b04619 100644 (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...)
 }