加了反转义,修复一个null被转成"null"的问题

pull/106/head
Celeter 5 years ago
parent 299cd4e937
commit 241d34b119
  1. 12
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeRule.kt

@ -8,6 +8,7 @@ import io.legado.app.data.entities.BaseBook
import io.legado.app.data.entities.BookChapter
import io.legado.app.help.JsExtensions
import io.legado.app.utils.*
import org.jsoup.nodes.Entities
import org.mozilla.javascript.NativeObject
import java.util.*
import java.util.regex.Pattern
@ -206,7 +207,7 @@ class AnalyzeRule(var book: BaseBook? = null) : JsExtensions {
else -> sourceRule.rule
}
}
if (sourceRule.replaceRegex.isNotEmpty()) {
if ((result != null) && sourceRule.replaceRegex.isNotEmpty()) {
result = replaceRegex(result.toString(), sourceRule)
}
}
@ -214,10 +215,15 @@ class AnalyzeRule(var book: BaseBook? = null) : JsExtensions {
}
}
if (result == null) result = ""
val str = try {
Entities.unescape(result.toString())
} catch (e: Exception) {
result.toString()
}
if (isUrl) {
return NetworkUtils.getAbsoluteURL(baseUrl, result.toString()) ?: ""
return NetworkUtils.getAbsoluteURL(baseUrl, str) ?: ""
}
return result.toString()
return str
}
/**

Loading…
Cancel
Save