Skip to content

Commit

Permalink
fix(HtmlFormatter.kt): 限制img正则
Browse files Browse the repository at this point in the history
src属性前必须有个空格,可能会命中错误
<img src="....." zy-enlarge-src="none">
close gedoor#3215
  • Loading branch information
Xwite authored Jul 11, 2023
1 parent b172f9a commit b636201
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/src/main/java/io/legado/app/utils/HtmlFormatter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down

0 comments on commit b636201

Please sign in to comment.