diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2018-05-11 16:15:18 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-11 16:15:18 +0800 |
commit | c14870c5ac52bf9d2d8b884222b4743accf9d929 (patch) | |
tree | 6a96283cd01130933743189a586786af31fa5cf2 /routers | |
parent | bc8400747a7f3fbeafdde1a137f32ef9ac25dff6 (diff) | |
download | gitea-c14870c5ac52bf9d2d8b884222b4743accf9d929.tar.gz gitea-c14870c5ac52bf9d2d8b884222b4743accf9d929.zip |
fix blank topic (#3948)
Diffstat (limited to 'routers')
-rw-r--r-- | routers/repo/topic.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/routers/repo/topic.go b/routers/repo/topic.go index 90ef0d189c..2a43d53ff0 100644 --- a/routers/repo/topic.go +++ b/routers/repo/topic.go @@ -21,7 +21,11 @@ func TopicPost(ctx *context.Context) { return } - topics := strings.Split(ctx.Query("topics"), ",") + var topics = make([]string, 0) + var topicsStr = strings.TrimSpace(ctx.Query("topics")) + if len(topicsStr) > 0 { + topics = strings.Split(topicsStr, ",") + } err := models.SaveTopics(ctx.Repo.Repository.ID, topics...) if err != nil { |