From d6d7348bec1779bb39dfef2a9f92b9f3a1e9e240 Mon Sep 17 00:00:00 2001 From: Xwite <1797350009@qq.com> Date: Thu, 3 Mar 2022 07:41:59 +0800 Subject: [PATCH] remove URLDecoder.decode --- .../java/io/legado/app/api/controller/BookController.kt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/io/legado/app/api/controller/BookController.kt b/app/src/main/java/io/legado/app/api/controller/BookController.kt index e1db7e76c..ab143db64 100644 --- a/app/src/main/java/io/legado/app/api/controller/BookController.kt +++ b/app/src/main/java/io/legado/app/api/controller/BookController.kt @@ -25,7 +25,6 @@ import kotlinx.coroutines.runBlocking import splitties.init.appCtx import java.io.File import java.io.FileOutputStream -import java.net.URLDecoder object BookController { @@ -56,7 +55,7 @@ object BookController { */ fun getCover(parameters: Map>): ReturnData { val returnData = ReturnData() - val coverPath = URLDecoder.decode(parameters["path"]?.firstOrNull(), "UTF-8") + val coverPath = parameters["path"]?.firstOrNull() val ftBitmap = ImageLoader.loadBitmap(appCtx, coverPath).submit() return try { returnData.setData(ftBitmap.get()) @@ -72,9 +71,9 @@ object BookController { val returnData = ReturnData() val bookUrl = parameters["url"]?.firstOrNull() ?: return returnData.setErrorMsg("bookUrl为空") - val book = appDb.bookDao.getBook(URLDecoder.decode(bookUrl, "UTF-8")) - ?: return returnData.setErrorMsg("bookUrl不对") - val src = URLDecoder.decode(parameters["path"]?.firstOrNull(), "UTF-8") + val book = appDb.bookDao.getBook(bookUrl) + ?: return returnData.setErrorMsg("bookUrl不对:${bookUrl}") + val src = parameters["path"]?.firstOrNull() val vFile = BookHelp.getImage(book, src) if (!vFile.exists()) { val bookSource = appDb.bookSourceDao.getBookSource(book.origin)