Explorar el Código

fix(HtmlFormatter.kt): 限制img正则

src属性前必须有个空格,可能会命中错误
<img src="....." zy-enlarge-src="none">
close #3215
Xwite hace 3 años
padre
commit
3e624ef62b
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1 1
      app/src/main/java/io/legado/app/utils/HtmlFormatter.kt

+ 1 - 1
app/src/main/java/io/legado/app/utils/HtmlFormatter.kt

@@ -17,7 +17,7 @@ object HtmlFormatter {
     private val notImgHtmlRegex = "</?(?!img)[a-zA-Z]+(?=[ >])[^<>]*>".toRegex()
     private val otherHtmlRegex = "</?[a-zA-Z]+(?=[ >])[^<>]*>".toRegex()
     private val formatImagePattern = Pattern.compile(
-        "<img[^>]*src *= *\"([^\"{>]*\\{(?:[^{}]|\\{[^}>]+\\})+\\})\"[^>]*>|<img[^>]*data-[^=>]*= *\"([^\">]*)\"[^>]*>|<img[^>]*src *= *\"([^\">]*)\"[^>]*>",
+        "<img[^>]* src *= *\"([^\"{>]*\\{(?:[^{}]|\\{[^}>]+\\})+\\})\"[^>]*>|<img[^>]* data-[^=>]*= *\"([^\">]*)\"[^>]*>|<img[^>]* src *= *\"([^\">]*)\"[^>]*>",
         Pattern.CASE_INSENSITIVE
     )