From e496ad670a140f83041f0ec204a72ec55101f824 Mon Sep 17 00:00:00 2001 From: Niko Storni Date: Thu, 20 Jun 2019 17:43:46 +0200 Subject: [PATCH] limit tag length --- tagsManager/tags_mapping.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tagsManager/tags_mapping.go b/tagsManager/tags_mapping.go index 8fb5ecd..b144133 100644 --- a/tagsManager/tags_mapping.go +++ b/tagsManager/tags_mapping.go @@ -71,6 +71,8 @@ func SanitizeTags(tags []string, youtubeChannelID string) ([]string, error) { return sanitizedTags, nil } +const TagMaxLength = 255 + func normalizeTag(t string) (string, error) { t = strings.ToLower(t) multipleSpaces := regexp.MustCompile(`\s{2,}`) @@ -87,7 +89,10 @@ func normalizeTag(t string) (string, error) { if weirdChars.MatchString(t) { log.Debugf("tag '%s' has weird stuff in it, skipping\n", t) return "", nil - + } + if len(t) > TagMaxLength { + log.Debugf("tag '%s' is too long, skipping\n", t) + return "", nil } return t, nil }