diff --git a/app/src/main/java/io/legado/app/help/JsExtensions.kt b/app/src/main/java/io/legado/app/help/JsExtensions.kt index e01fe20e4..eb0f4cda8 100644 --- a/app/src/main/java/io/legado/app/help/JsExtensions.kt +++ b/app/src/main/java/io/legado/app/help/JsExtensions.kt @@ -314,13 +314,17 @@ interface JsExtensions { /** * 获取网络zip文件里面的数据 - * @param url zip文件的链接 + * @param url zip文件的链接或十六进制字符串 * @param path 所需获取文件在zip内的路径 * @return zip指定文件的数据 */ fun getZipStringContent(url: String, path: String): String { - val bytes = runBlocking { - return@runBlocking okHttpClient.newCall { url(url) }.bytes() + val bytes = if (url.startsWith("http://") || url.startsWith("https://")) { + runBlocking { + return@runBlocking okHttpClient.newCall { url(url) }.bytes() + } + } else { + StringUtils.hexStringToByte(url) } val bos = ByteArrayOutputStream() val zis = ZipInputStream(ByteArrayInputStream(bytes)) @@ -341,13 +345,17 @@ interface JsExtensions { /** * 获取网络zip文件里面的数据 - * @param url zip文件的链接 + * @param url zip文件的链接或十六进制字符串 * @param path 所需获取文件在zip内的路径 * @return zip指定文件的数据 */ fun getZipByteArrayContent(url: String, path: String): ByteArray? { - val bytes = runBlocking { - return@runBlocking okHttpClient.newCall { url(url) }.bytes() + val bytes = if (url.startsWith("http://") || url.startsWith("https://")) { + runBlocking { + return@runBlocking okHttpClient.newCall { url(url) }.bytes() + } + } else { + StringUtils.hexStringToByte(url) } val bos = ByteArrayOutputStream() val zis = ZipInputStream(ByteArrayInputStream(bytes))