lanraragi: FIX: 404 error when baseurl contains additional path (#9340)
This commit is contained in:
parent
2fd8684f2e
commit
6ee4ab2521
@ -1,7 +1,7 @@
|
|||||||
ext {
|
ext {
|
||||||
extName = 'LANraragi'
|
extName = 'LANraragi'
|
||||||
extClass = '.LANraragiFactory'
|
extClass = '.LANraragiFactory'
|
||||||
extVersionCode = 19
|
extVersionCode = 20
|
||||||
}
|
}
|
||||||
|
|
||||||
apply from: "$rootDir/common.gradle"
|
apply from: "$rootDir/common.gradle"
|
||||||
|
@ -35,6 +35,7 @@ import rx.schedulers.Schedulers
|
|||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
import uy.kohesive.injekt.api.get
|
import uy.kohesive.injekt.api.get
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
|
import java.net.URL
|
||||||
import java.security.MessageDigest
|
import java.security.MessageDigest
|
||||||
import kotlin.math.max
|
import kotlin.math.max
|
||||||
|
|
||||||
@ -138,7 +139,12 @@ open class LANraragi(private val suffix: String = "") : ConfigurableSource, Unme
|
|||||||
val archivePage = json.decodeFromString<ArchivePage>(response.body.string())
|
val archivePage = json.decodeFromString<ArchivePage>(response.body.string())
|
||||||
|
|
||||||
return archivePage.pages.mapIndexed { index, url ->
|
return archivePage.pages.mapIndexed { index, url ->
|
||||||
val uri = Uri.parse("${baseUrl}${url.trimStart('.')}")
|
var newUrl = url
|
||||||
|
val subPath = URL(baseUrl).path
|
||||||
|
if (!subPath.isNullOrEmpty()) {
|
||||||
|
newUrl = newUrl.replaceFirst(subPath, "")
|
||||||
|
}
|
||||||
|
val uri = Uri.parse("${baseUrl}${newUrl.trimStart('.')}")
|
||||||
Page(index, uri.toString(), uri.toString(), uri)
|
Page(index, uri.toString(), uri.toString(), uri)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user