fixed bug with json for manga that were added pre id only url (#239)
This commit is contained in:
parent
b650471af6
commit
5583a68623
|
@ -5,8 +5,8 @@ ext {
|
||||||
appName = 'Tachiyomi: MangaDex'
|
appName = 'Tachiyomi: MangaDex'
|
||||||
pkgNameSuffix = "all.mangadex"
|
pkgNameSuffix = "all.mangadex"
|
||||||
extClass = '.MangadexFactory'
|
extClass = '.MangadexFactory'
|
||||||
extVersionCode = 12
|
extVersionCode = 13
|
||||||
extVersionSuffix = 12
|
extVersionSuffix = 13
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -172,7 +172,16 @@ open class Mangadex(override val lang: String, private val internalLang: String,
|
||||||
return GET(baseUrl + URL + getMangaId(manga.url), headers)
|
return GET(baseUrl + URL + getMangaId(manga.url), headers)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getMangaId(url: String) = url.trimEnd('/').substringAfterLast("/")
|
private fun getMangaId(url: String): String {
|
||||||
|
|
||||||
|
val lastSection = url.trimEnd('/').substringAfterLast("/")
|
||||||
|
return if (lastSection.toIntOrNull() != null) {
|
||||||
|
lastSection
|
||||||
|
} else {
|
||||||
|
//this occurs if person has manga from before that had the id/name/
|
||||||
|
url.trimEnd('/').substringBeforeLast("/").substringAfterLast("/")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun mangaDetailsParse(response: Response): SManga {
|
override fun mangaDetailsParse(response: Response): SManga {
|
||||||
val manga = SManga.create()
|
val manga = SManga.create()
|
||||||
|
|
Loading…
Reference in New Issue