From 4a738a8f1601d6c13dc6699d3c6985ed57eee802 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sun, 27 Dec 2020 02:57:06 +0000 Subject: [PATCH] Migration: drop too long repo topics (#14152) (#14155) * Migration: drop to long repo topics * Update modules/migrations/gitea_uploader.go --- modules/migrations/gitea_uploader.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/migrations/gitea_uploader.go b/modules/migrations/gitea_uploader.go index 2cb19685fc..334ddad54f 100644 --- a/modules/migrations/gitea_uploader.go +++ b/modules/migrations/gitea_uploader.go @@ -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...) }