pull/2385/head
kunfei 2 years ago
parent c4d474f3d9
commit f1938ee677
  1. 8
      app/src/main/java/io/legado/app/model/localBook/LocalBook.kt

@ -16,9 +16,9 @@ import io.legado.app.exception.NoStackTraceException
import io.legado.app.exception.TocEmptyException
import io.legado.app.help.AppWebDav
import io.legado.app.help.book.BookHelp
import io.legado.app.help.book.getRemoteUrl
import io.legado.app.help.book.isEpub
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.lib.webdav.WebDav
import io.legado.app.model.analyzeRule.AnalyzeUrl
@ -44,7 +44,11 @@ object LocalBook {
@Throws(FileNotFoundException::class, SecurityException::class)
fun getBookInputStream(book: Book): InputStream {
val uri = Uri.parse(book.bookUrl)
val uri = if (book.bookUrl.isContentScheme()) {
Uri.parse(book.bookUrl)
} else {
Uri.fromFile(File(book.bookUrl))
}
//文件不存在 尝试下载webDav文件 book.remoteUrl
val inputStream = uri.inputStream(appCtx) ?: downloadRemoteBook(book)
if (inputStream != null) return inputStream

Loading…
Cancel
Save