mirror of
https://github.com/gedoor/legado.git
synced 2025-08-10 00:52:30 +00:00
优化dataUri处理
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user