fix(EpubFile/parseFirstPage): parse all contents

fix #1932
pull/1936/head
Xwite 3 years ago
parent ad5aef2bc1
commit 2bf6a4b39c
  1. 12
      app/src/main/java/io/legado/app/model/localBook/EpubFile.kt

@ -139,10 +139,10 @@ class EpubFile(var book: Book) {
* content src text/000001.html当前章节
- * content src text/000001.html#toc_id_x (下一章节
*/
if (!nextUrl.isNullOrBlank() && res.href == nextUrl!!.substringBeforeLast("#")) break
if (res.href == nextUrl?.substringBeforeLast("#")) break
} else if (isChapter) {
// fix 最后一章存在多个html时 内容缺失
if (!nextUrl.isNullOrBlank() && res.href == nextUrl.substringBeforeLast("#")) {
if (res.href == nextUrl?.substringBeforeLast("#")) {
break
}
elements.add(getBody(res, startFragmentId, endFragmentId))
@ -276,8 +276,12 @@ class EpubFile(var book: Book) {
while (i < contents.size) {
val content = contents[i]
if (!content.mediaType.toString().contains("htm")) continue
/*检索到第一章href停止*/
if (refs[0].completeHref == content.href) break
/**
* 检索到第一章href停止
* completeHref可能有fragment(#id) 必须去除
* fix https://github.com/gedoor/legado/issues/1932
*/
if (refs[0].completeHref.substringBeforeLast("#") == content.href) break
val chapter = BookChapter()
var title = content.title
if (TextUtils.isEmpty(title)) {

Loading…
Cancel
Save