diff --git a/app/src/main/java/io/legado/app/model/webBook/BookChapterList.kt b/app/src/main/java/io/legado/app/model/webBook/BookChapterList.kt index 9c56f3d7d..d3a244f64 100644 --- a/app/src/main/java/io/legado/app/model/webBook/BookChapterList.kt +++ b/app/src/main/java/io/legado/app/model/webBook/BookChapterList.kt @@ -15,9 +15,10 @@ import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.async import kotlinx.coroutines.ensureActive import kotlinx.coroutines.withContext - import splitties.init.appCtx +import java.net.URLDecoder +@Suppress("BlockingMethodInNonBlockingContext") object BookChapterList { suspend fun analyzeChapterList( @@ -27,7 +28,7 @@ object BookChapterList { book: Book, redirectUrl: String ): List { - val baseUrl = strResponse.url + val baseUrl = URLDecoder.decode(strResponse.url, "utf-8") val body = strResponse.body body ?: throw Exception( appCtx.getString(R.string.error_get_web_content, baseUrl) diff --git a/app/src/main/java/io/legado/app/model/webBook/BookContent.kt b/app/src/main/java/io/legado/app/model/webBook/BookContent.kt index 84ddc575a..a34629b58 100644 --- a/app/src/main/java/io/legado/app/model/webBook/BookContent.kt +++ b/app/src/main/java/io/legado/app/model/webBook/BookContent.kt @@ -19,7 +19,9 @@ import kotlinx.coroutines.async import kotlinx.coroutines.ensureActive import kotlinx.coroutines.withContext import splitties.init.appCtx +import java.net.URLDecoder +@Suppress("BlockingMethodInNonBlockingContext") object BookContent { @Throws(Exception::class) @@ -32,7 +34,7 @@ object BookContent { redirectUrl: String, nextChapterUrl: String? = null ): String { - val baseUrl = strResponse.url + val baseUrl = URLDecoder.decode(strResponse.url, "utf-8") val body = strResponse.body body ?: throw Exception( appCtx.getString(R.string.error_get_web_content, baseUrl) diff --git a/app/src/main/java/io/legado/app/model/webBook/BookInfo.kt b/app/src/main/java/io/legado/app/model/webBook/BookInfo.kt index d479172a3..0149a976d 100644 --- a/app/src/main/java/io/legado/app/model/webBook/BookInfo.kt +++ b/app/src/main/java/io/legado/app/model/webBook/BookInfo.kt @@ -13,6 +13,7 @@ import io.legado.app.utils.StringUtils.wordCountFormat import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.ensureActive import splitties.init.appCtx +import java.net.URLDecoder object BookInfo { @@ -25,7 +26,7 @@ object BookInfo { redirectUrl: String, canReName: Boolean, ) { - val baseUrl = strResponse.url + val baseUrl = URLDecoder.decode(strResponse.url, "utf-8") val body = strResponse.body body ?: throw Exception( appCtx.getString(R.string.error_get_web_content, baseUrl) diff --git a/app/src/main/java/io/legado/app/model/webBook/BookList.kt b/app/src/main/java/io/legado/app/model/webBook/BookList.kt index 50069c8cb..110e7bec5 100644 --- a/app/src/main/java/io/legado/app/model/webBook/BookList.kt +++ b/app/src/main/java/io/legado/app/model/webBook/BookList.kt @@ -16,6 +16,7 @@ import io.legado.app.utils.StringUtils.wordCountFormat import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.ensureActive import splitties.init.appCtx +import java.net.URLDecoder object BookList { @@ -28,7 +29,7 @@ object BookList { variableBook: SearchBook, isSearch: Boolean = true, ): ArrayList { - val baseUrl = strResponse.url + val baseUrl = URLDecoder.decode(strResponse.url, "utf-8") val body = strResponse.body body ?: throw Exception( appCtx.getString(