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) }