diff --git a/app/src/main/java/io/legado/app/data/entities/BookChapter.kt b/app/src/main/java/io/legado/app/data/entities/BookChapter.kt
index 6162779cb..67bba2e5d 100644
--- a/app/src/main/java/io/legado/app/data/entities/BookChapter.kt
+++ b/app/src/main/java/io/legado/app/data/entities/BookChapter.kt
@@ -61,7 +61,14 @@ data class BookChapter(
return false
}
- fun getAbsoluteURL() = url.replace("^\\s*([^,\\s]+)\\s*".toRegex()){ NetworkUtils.getAbsoluteURL(baseUrl,it.groupValues[1]) }
+ fun getAbsoluteURL():String{
+ val pos = url.indexOf(',')
+ return if(pos == -1) NetworkUtils.getAbsoluteURL(baseUrl,url)
+ else NetworkUtils.getAbsoluteURL(
+ baseUrl,
+ url.substring(0, pos)
+ ) + url.substring(pos)
+ }
fun getFileName(): String = String.format("%05d-%s.nb", index, MD5Utils.md5Encode16(title))
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 9370e44d6..fd1d6894e 100644
--- a/app/src/main/java/io/legado/app/utils/HtmlFormatter.kt
+++ b/app/src/main/java/io/legado/app/utils/HtmlFormatter.kt
@@ -32,15 +32,48 @@ object HtmlFormatter {
val matcher = imgPattern.matcher(keepImgHtml)
var appendPos = 0
- while (matcher.find()) {
+
+ if(matcher.find()){
+ var url = matcher.group(1)!!
+ var pos = url.indexOf(',')
sb.append(keepImgHtml.substring(appendPos, matcher.start()))
- sb.append("")
+ sb.append(
+ ""
+ )
appendPos = matcher.end()
+ if(pos == -1) {
+ while (matcher.find()) {
+ sb.append(keepImgHtml.substring(appendPos, matcher.start()))
+ sb.append( "" )
+ appendPos = matcher.end()
+ }
+ }else{
+ while (matcher.find()) {
+ url = matcher.group(1)!!
+ pos = url.indexOf(',')
+ sb.append(keepImgHtml.substring(appendPos, matcher.start()))
+ sb.append(
+ ""
+ )
+ appendPos = matcher.end()
+ }
+ }
}
+
if (appendPos < keepImgHtml.length) {
sb.append(keepImgHtml.substring(appendPos, keepImgHtml.length))
}