From cc21e86cfa40ee3f0d0a9ec93d5159c70d84e099 Mon Sep 17 00:00:00 2001 From: Xwite <1797350009@qq.com> Date: Mon, 13 Mar 2023 06:07:55 +0800 Subject: [PATCH] [skip ci] --- .../java/io/legado/app/model/localBook/LocalBook.kt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/io/legado/app/model/localBook/LocalBook.kt b/app/src/main/java/io/legado/app/model/localBook/LocalBook.kt index 8d629dcb6..7a41b7d3d 100644 --- a/app/src/main/java/io/legado/app/model/localBook/LocalBook.kt +++ b/app/src/main/java/io/legado/app/model/localBook/LocalBook.kt @@ -156,12 +156,12 @@ object LocalBook { * 导入本地文件 */ fun importFile(uri: Uri): Book { - val fileDoc = FileDoc.fromUri(uri, false) + val bookUrl: String //updateTime变量不要修改,否则会导致读取不到缓存 - val (fileName, _, fileSize, _, updateTime, _) = fileDoc - val bookUrl = fileDoc.toString() - //空文件不导入 - if (fileSize == 0L) throw EmptyFileException("Unexpected empty File") + val (fileName, _, _, _, updateTime, _) = FileDoc.fromUri(uri, false).apply { + if (size == 0L) throw EmptyFileException("Unexpected empty File") + bookUrl = toString() + } var book = appDb.bookDao.getBook(bookUrl) if (book == null) { val nameAuthor = analyzeNameAuthor(fileName)