File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -2197,7 +2197,11 @@ function initTopicbar() {
21972197 alert ( res . message ) ;
21982198 } else {
21992199 viewDiv . children ( ".topic" ) . remove ( ) ;
2200+ if ( topics . length == 0 ) {
2201+ return
2202+ }
22002203 var topicArray = topics . split ( "," ) ;
2204+
22012205 var last = viewDiv . children ( "a" ) . last ( ) ;
22022206 for ( var i = 0 ; i < topicArray . length ; i ++ ) {
22032207 $ ( '<div class="ui green basic label topic" style="cursor:pointer;">' + topicArray [ i ] + '</div>' ) . insertBefore ( last )
Original file line number Diff line number Diff line change @@ -21,7 +21,11 @@ func TopicPost(ctx *context.Context) {
2121 return
2222 }
2323
24- topics := strings .Split (ctx .Query ("topics" ), "," )
24+ var topics = make ([]string , 0 )
25+ var topicsStr = strings .TrimSpace (ctx .Query ("topics" ))
26+ if len (topicsStr ) > 0 {
27+ topics = strings .Split (topicsStr , "," )
28+ }
2529
2630 err := models .SaveTopics (ctx .Repo .Repository .ID , topics ... )
2731 if err != nil {
You can’t perform that action at this time.
0 commit comments