pull/62/head
kunfei 5 years ago
parent 0d060a5ec8
commit ad6f9c4f27
  1. 14
      app/src/main/java/io/legado/app/help/storage/OldRule.kt

@ -5,11 +5,7 @@ import io.legado.app.constant.BookType
import io.legado.app.data.entities.BookSource
import io.legado.app.data.entities.rule.*
import io.legado.app.help.storage.Restore.jsonPath
import io.legado.app.utils.GSON
import io.legado.app.utils.fromJsonObject
import io.legado.app.utils.readInt
import io.legado.app.utils.readString
import io.legado.app.utils.readBool
import io.legado.app.utils.*
import java.util.regex.Pattern
object OldRule {
@ -129,7 +125,10 @@ object OldRule {
newRule = newRule.replace("|", "||")
}
}
if (newRule.contains("&") && !newRule.contains("&&")) {
if (newRule.contains("&")
&& !newRule.contains("&&")
&& !newRule.contains("http")
) {
newRule = newRule.replace("&", "&&")
}
}
@ -145,10 +144,9 @@ object OldRule {
return toNewUrl(oldUrls)
val urls = oldUrls.split("(&&|\n)+".toRegex())
val newUrls = urls.map {
return urls.map {
toNewUrl(it)?.replace("\n\\s*".toRegex(), "")
}.joinToString("\n")
return newUrls
}
private fun toNewUrl(oldUrl: String?): String? {

Loading…
Cancel
Save