refactor: use book.getRemoteUrl (#2381)

pull/2382/head
Xwite 2 years ago committed by GitHub
parent 5e874aed52
commit bc357f7c48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      app/src/main/java/io/legado/app/model/localBook/LocalBook.kt

@ -18,6 +18,7 @@ import io.legado.app.help.AppWebDav
import io.legado.app.help.book.BookHelp import io.legado.app.help.book.BookHelp
import io.legado.app.help.book.isEpub import io.legado.app.help.book.isEpub
import io.legado.app.help.book.isUmd import io.legado.app.help.book.isUmd
import io.legado.app.help.book.getRemoteUrl
import io.legado.app.help.config.AppConfig import io.legado.app.help.config.AppConfig
import io.legado.app.lib.webdav.WebDav import io.legado.app.lib.webdav.WebDav
import io.legado.app.model.analyzeRule.AnalyzeUrl import io.legado.app.model.analyzeRule.AnalyzeUrl
@ -307,10 +308,8 @@ object LocalBook {
//下载book.remoteUrl对应的远程文件并更新bookUrl 返回inputStream //下载book.remoteUrl对应的远程文件并更新bookUrl 返回inputStream
private fun downloadRemoteBook(localBook: Book): InputStream? { private fun downloadRemoteBook(localBook: Book): InputStream? {
//webDav::${http} val webDavUrl = localBook.getRemoteUrl()
if (!localBook.origin.startsWith(BookType.webDavTag)) return null if (webDavUrl.isNullOrBlank()) return null
val webDavUrl = localBook.origin.substring(8)
if (webDavUrl.isBlank()) return null
try { try {
val uri = AppWebDav.authorization?.let { val uri = AppWebDav.authorization?.let {
val webdav = WebDav(webDavUrl, it) val webdav = WebDav(webDavUrl, it)

Loading…
Cancel
Save