Browse Source

no message

xingzai 1 year ago
parent
commit
670590bced
1 changed files with 4 additions and 2 deletions
  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")