binary.BigEndian.PutUint32(article.ParentArt[:], parentArticleID)
+ if len(newsPath) == 0 {
+ return fmt.Errorf("invalid news path")
+ }
+
cats := n.getCatByPath(newsPath[:len(newsPath)-1])
catName := newsPath[len(newsPath)-1]
// // TODO: Handle delete recursive
//}
+ if len(newsPath) == 0 {
+ return fmt.Errorf("invalid news path")
+ }
+
cats := n.getCatByPath(newsPath[:len(newsPath)-1])
catName := newsPath[len(newsPath)-1]
// None
func HandleDelNewsItem(cc *hotline.ClientConn, t *hotline.Transaction) (res []hotline.Transaction) {
pathStrs, err := t.GetField(hotline.FieldNewsPath).DecodeNewsPath()
- if err != nil {
- return res
+ if err != nil || len(pathStrs) == 0 {
+ cc.Logger.Error("invalid news path")
+ return nil
}
item := cc.Server.ThreadedNewsMgr.NewsItem(pathStrs)
}
pathStrs, err := t.GetField(hotline.FieldNewsPath).DecodeNewsPath()
- if err != nil {
+ if err != nil || len(pathStrs) == 0 {
+ cc.Logger.Error("invalid news path")
return res
}