1
0
Fork 0
forked from forgejo/forgejo

Fix the topic validation rule and suport dots (#26286) (#26303)

Backport #26286 by @wxiaoguang

1. Allow leading and trailing spaces by user input, these spaces have
already been trimmed at backend
2. Allow using dots in the topic

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
(cherry picked from commit fcd055c34a)
This commit is contained in:
Giteabot 2023-08-04 13:00:49 +08:00 committed by Earl Warren
parent db326835e6
commit 9e4be39acb
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
4 changed files with 5 additions and 3 deletions

View file

@ -22,7 +22,7 @@ func init() {
db.RegisterModel(new(RepoTopic))
}
var topicPattern = regexp.MustCompile(`^[a-z0-9][a-z0-9-]*$`)
var topicPattern = regexp.MustCompile(`^[a-z0-9][-.a-z0-9]*$`)
// Topic represents a topic of repositories
type Topic struct {