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 77eb6ad2a..21d45d62c 100644 --- a/app/src/main/java/io/legado/app/utils/HtmlFormatter.kt +++ b/app/src/main/java/io/legado/app/utils/HtmlFormatter.kt @@ -22,8 +22,9 @@ object HtmlFormatter { fun formatKeepImg(html: String?, redirectUrl: URL?): String { html ?: return "" + val keepImgHtml = formatKeepImg(html) val sb = StringBuffer() - val matcher = AppPattern.imgPattern.matcher(formatKeepImg(html)) + val matcher = AppPattern.imgPattern.matcher(keepImgHtml) var appendPos = 0 while (matcher.find()) { val urlArray = matcher.group(1)!!.split(AnalyzeUrl.splitUrlRegex) @@ -31,12 +32,12 @@ object HtmlFormatter { if (urlArray.size > 1) { url = "$url,${urlArray[1]}" } - sb.append(html.substring(appendPos, matcher.start())) + sb.append(keepImgHtml.substring(appendPos, matcher.start())) sb.append("") appendPos = matcher.end() } - if (appendPos < html.length) { - sb.append(html.substring(appendPos, html.length)) + if (appendPos < keepImgHtml.length) { + sb.append(keepImgHtml.substring(appendPos, keepImgHtml.length)) } return sb.toString() }