Merge pull request #179 from Celeter/master

修复3.0书源的搜索url为空时无法导入书源的bug
pull/182/head
kunfei 5 years ago committed by GitHub
commit 074ce28e7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      app/src/main/java/io/legado/app/help/BookHelp.kt
  2. 2
      app/src/main/java/io/legado/app/help/storage/OldRule.kt
  3. 1
      app/src/main/java/io/legado/app/model/webBook/BookContent.kt

@ -237,6 +237,5 @@ object BookHelp {
} }
return c return c
.replace("\\s*\\n+\\s*".toRegex(), "\n${ReadBookConfig.bodyIndent}") .replace("\\s*\\n+\\s*".toRegex(), "\n${ReadBookConfig.bodyIndent}")
.replace("[\\n\\s]+$".toRegex(), "") //移除尾部空行
} }
} }

@ -19,7 +19,7 @@ object OldRule {
source = GSON.fromJsonObject<BookSource>(json.trim()) source = GSON.fromJsonObject<BookSource>(json.trim())
} }
runCatching { runCatching {
if (source == null || source?.searchUrl.isNullOrBlank()) { if (source == null || source?.ruleToc.isNullOrBlank()) {
source = BookSource().apply { source = BookSource().apply {
val jsonItem = jsonPath.parse(json.trim()) val jsonItem = jsonPath.parse(json.trim())
bookSourceUrl = jsonItem.readString("bookSourceUrl") ?: "" bookSourceUrl = jsonItem.readString("bookSourceUrl") ?: ""

@ -101,6 +101,7 @@ object BookContent {
} }
} }
content.deleteCharAt(content.length - 1)
Debug.log(bookSource.bookSourceUrl, "┌获取章节名称") Debug.log(bookSource.bookSourceUrl, "┌获取章节名称")
Debug.log(bookSource.bookSourceUrl, "${bookChapter.title}") Debug.log(bookSource.bookSourceUrl, "${bookChapter.title}")
Debug.log(bookSource.bookSourceUrl, "┌获取正文内容") Debug.log(bookSource.bookSourceUrl, "┌获取正文内容")

Loading…
Cancel
Save