浏览代码

no message

xingzai 1 年之前
父节点
当前提交
670590bced
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 4 2
      services/article.go

+ 4 - 2
services/article.go

@@ -452,8 +452,10 @@ func AnnotationHtml(bodyText string) (annotation string) {
 		pdText = strings.Replace(pdText, " ", "", -1)
 		if pdText != "" {
 			textLen := strings.Index(docText, pdText)
-			mapDoc[(strings.Index(docText, pdText))] = pdText
-			mapSort = append(mapSort, textLen)
+			if textLen >= 0 {
+				mapDoc[(strings.Index(docText, pdText))] = pdText
+				mapSort = append(mapSort, textLen)
+			}
 		}
 	})
 	li := doc.Find("li")