From cc05cf2f35d5f1e475fe929945370c47415a5847 Mon Sep 17 00:00:00 2001 From: Trim21 Date: Thu, 10 Oct 2024 18:56:57 +0800 Subject: [PATCH] fix: only allow at most 10 tags --- web/req/collection.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/web/req/collection.go b/web/req/collection.go index ae4cc4a3..f0e5d6aa 100644 --- a/web/req/collection.go +++ b/web/req/collection.go @@ -50,6 +50,10 @@ func (v *SubjectEpisodeCollectionPatch) Validate() error { } if v.Tags != nil { + if len(v.Tags) > 10 { + return res.BadRequest("最多允许 10 个标签") + } + v.Tags = lo.Map(v.Tags, func(item string, index int) string { return norm.NFKC.String(item) })