From c9ccda2ca7916ce1b2444a9db59535876bacf31e Mon Sep 17 00:00:00 2001 From: kunfei Date: Mon, 20 Jun 2022 22:05:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/legado/app/ui/book/remote/RemoteBook.kt | 2 +- .../io/legado/app/ui/book/remote/RemoteBookActivity.kt | 4 ++++ .../io/legado/app/ui/book/remote/RemoteBookAdapter.kt | 3 ++- .../legado/app/ui/book/remote/manager/RemoteBookWebDav.kt | 8 +++----- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/remote/RemoteBook.kt b/app/src/main/java/io/legado/app/ui/book/remote/RemoteBook.kt index 65de6ac2d..1b3a2d003 100644 --- a/app/src/main/java/io/legado/app/ui/book/remote/RemoteBook.kt +++ b/app/src/main/java/io/legado/app/ui/book/remote/RemoteBook.kt @@ -2,7 +2,7 @@ package io.legado.app.ui.book.remote data class RemoteBook( val filename: String, - val urlName: String, + val path: String, val size: Long, val contentType: String, val lastModify: Long, diff --git a/app/src/main/java/io/legado/app/ui/book/remote/RemoteBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/remote/RemoteBookActivity.kt index c6f109962..e27401a3e 100644 --- a/app/src/main/java/io/legado/app/ui/book/remote/RemoteBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/remote/RemoteBookActivity.kt @@ -67,6 +67,10 @@ class RemoteBookActivity : VMBaseActivity var webDavFileName = webDavFile.displayName - var webDavUrlName = "${remoteBookUrl}${File.separator}${webDavFile.displayName}" webDavFileName = URLDecoder.decode(webDavFileName, "utf-8") - webDavUrlName = URLDecoder.decode(webDavUrlName, "utf-8") if (webDavFile.isDir) { remoteBooks.add( RemoteBook( - webDavFileName, webDavUrlName, webDavFile.size, + webDavFileName, webDavFile.path, webDavFile.size, "folder", webDavFile.lastModify, false ) ) @@ -65,7 +63,7 @@ object RemoteBookWebDav : RemoteBookManager() { val isOnBookShelf = LocalBook.isOnBookShelf(webDavFileName) remoteBooks.add( RemoteBook( - webDavFileName, webDavUrlName, webDavFile.size, + webDavFileName, webDavFile.path, webDavFile.size, fileExtension, webDavFile.lastModify, isOnBookShelf ) ) @@ -81,7 +79,7 @@ object RemoteBookWebDav : RemoteBookManager() { */ override suspend fun getRemoteBook(remoteBook: RemoteBook): Uri? { return AppWebDav.authorization?.let { - val webdav = WebDav(remoteBook.urlName, it) + val webdav = WebDav(remoteBook.path, it) webdav.download().let { bytes -> LocalBook.saveBookFile(bytes, remoteBook.filename) }