pull/478/head
gedoor 4 years ago
parent 1003500fcd
commit 9df517ccef
  1. 1
      app/src/main/java/io/legado/app/utils/NetworkUtils.kt
  2. 3
      app/src/main/java/io/legado/app/utils/StringExtensions.kt

@ -80,6 +80,7 @@ object NetworkUtils {
fun getAbsoluteURL(baseURL: String?, relativePath: String?): String? { fun getAbsoluteURL(baseURL: String?, relativePath: String?): String? {
if (baseURL.isNullOrEmpty()) return relativePath if (baseURL.isNullOrEmpty()) return relativePath
if (relativePath.isNullOrEmpty()) return baseURL if (relativePath.isNullOrEmpty()) return baseURL
if (relativePath.isAbsUrl()) return baseURL
var relativeUrl = relativePath var relativeUrl = relativePath
try { try {
val absoluteUrl = URL(baseURL.substringBefore(",")) val absoluteUrl = URL(baseURL.substringBefore(","))

@ -23,8 +23,7 @@ fun String.parseToUri(): Uri {
fun String?.isAbsUrl() = fun String?.isAbsUrl() =
this?.let { this?.let {
it.startsWith("http://", true) it.startsWith("http://", true) || it.startsWith("https://", true)
|| it.startsWith("https://", true)
} ?: false } ?: false
fun String?.isJson(): Boolean = fun String?.isJson(): Boolean =

Loading…
Cancel
Save