From 952581db056d8edece4b6007cb094262e3657eb7 Mon Sep 17 00:00:00 2001 From: gedoor Date: Tue, 15 Jun 2021 15:39:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DhtmlFormatter=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/utils/HtmlFormatter.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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() }