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 0cdba44a5..887b7c159 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 @@ -127,9 +127,7 @@ object BookInfo { Debug.log(bookSource.bookSourceUrl, "┌获取封面链接") try { analyzeRule.getString(infoRule.coverUrl).let { - if (it.startsWith("data:")) { - book.coverUrl = it - } else if (it.isNotEmpty()) { + if (it.isNotEmpty()) { book.coverUrl = NetworkUtils.getAbsoluteURL(baseUrl, it) } 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 6e04bad03..bcee6b537 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 @@ -229,9 +229,7 @@ object BookList { Debug.log(bookSource.bookSourceUrl, "┌获取封面链接", log) try { analyzeRule.getString(ruleCoverUrl).let { - if (it.startsWith("data:")) { - searchBook.coverUrl = it - } else if (it.isNotEmpty()) { + if (it.isNotEmpty()) { searchBook.coverUrl = NetworkUtils.getAbsoluteURL(baseUrl, it) } diff --git a/app/src/main/java/io/legado/app/utils/NetworkUtils.kt b/app/src/main/java/io/legado/app/utils/NetworkUtils.kt index 82c7636be..4c35021ce 100644 --- a/app/src/main/java/io/legado/app/utils/NetworkUtils.kt +++ b/app/src/main/java/io/legado/app/utils/NetworkUtils.kt @@ -4,6 +4,7 @@ import android.net.ConnectivityManager import android.net.NetworkCapabilities import android.os.Build import io.legado.app.constant.AppLog +import io.legado.app.constant.AppPattern import okhttp3.internal.publicsuffix.PublicSuffixDatabase import splitties.systemservices.connectivityManager @@ -110,6 +111,7 @@ object NetworkUtils { fun getAbsoluteURL(baseURL: String?, relativePath: String): String { if (baseURL.isNullOrEmpty()) return relativePath if (relativePath.isAbsUrl()) return relativePath + if (relativePath.matches(AppPattern.dataUriRegex)) return relativePath if (relativePath.startsWith("javascript")) return "" var relativeUrl = relativePath try {