]> source.dussan.org Git - gitea.git/commitdiff
Migration: drop to long repo topics (#14152)
author6543 <6543@obermui.de>
Sun, 27 Dec 2020 01:23:57 +0000 (01:23 +0000)
committerGitHub <noreply@github.com>
Sun, 27 Dec 2020 01:23:57 +0000 (09:23 +0800)
modules/migrations/gitea_uploader.go

index 20d7d81ae1e84c2b8ea098752c159de8e057ec09..91ddda9c3958ca05bb7fe7ac2936ec61b14c0f40 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]) <= 50 {
+                       topics[c] = topics[i]
+                       c++
+               }
+       }
+       topics = topics[:c]
        return models.SaveTopics(g.repo.ID, topics...)
 }