diff --git a/app/src/main/java/io/legado/app/utils/HtmlFormatter.kt b/app/src/main/java/io/legado/app/utils/HtmlFormatter.kt
index d4c32b68c..fc5d75c51 100644
--- a/app/src/main/java/io/legado/app/utils/HtmlFormatter.kt
+++ b/app/src/main/java/io/legado/app/utils/HtmlFormatter.kt
@@ -7,7 +7,7 @@ object HtmlFormatter {
private val wrapHtmlRegex = "?(?:div|p|br|hr|h\\d|article|dd|dl)[^>]*>".toRegex()
private val notImgHtmlRegex = "?(?!img)[a-zA-Z]+(?=[ >])[^<>]*>".toRegex()
private val otherHtmlRegex = "?[a-zA-Z]+(?=[ >])[^<>]*>".toRegex()
- private val imgPattern = Pattern.compile("(]*src=\"([^\"]+)\"[^>]*(>)")
+ private val imgPattern = Pattern.compile("]*src=.*?\"(.*?(?:,\\{.*\\})?)\".*?>")
fun format(html: String?): String {
html ?: return ""
@@ -32,8 +32,8 @@ object HtmlFormatter {
val sb = StringBuffer()
val matcher = imgPattern.matcher(html)
while (matcher.find()) {
- val url = NetworkUtils.getAbsoluteURL(redirectUrl, matcher.group(2)!!)
- matcher.appendReplacement(sb, "${matcher.group(1)} src=\"$url\"${matcher.group(3)}")
+ val url = NetworkUtils.getAbsoluteURL(redirectUrl, matcher.group(1)!!)
+ matcher.appendReplacement(sb, "")
}
matcher.appendTail(sb)
return sb.replace(wrapHtmlRegex, "\n")