mirror of
https://github.com/gedoor/legado.git
synced 2025-08-10 00:52:30 +00:00
fix: 本地导入没有包含在数组内的单个书源时无法解析
This commit is contained in:
@@ -50,7 +50,7 @@ object SourceAnalyzer {
|
||||
return kotlin.runCatching {
|
||||
val bookSources = mutableListOf<BookSource>()
|
||||
val documentContext = jsonPath.parse(inputStream)
|
||||
kotlin.runCatching {
|
||||
try {
|
||||
val items: List<Map<String, Any>> = documentContext.read("$")
|
||||
for (item in items) {
|
||||
val jsonItem = jsonPath.parse(item)
|
||||
@@ -58,13 +58,13 @@ object SourceAnalyzer {
|
||||
bookSources.add(it)
|
||||
}
|
||||
}
|
||||
}.onFailure {
|
||||
} catch {
|
||||
val item: Map<String, Any> = documentContext.read("$")
|
||||
val jsonItem = jsonPath.parse(item)
|
||||
jsonToBookSource(jsonItem.jsonString()).getOrThrow().let {
|
||||
bookSources.add(it)
|
||||
}
|
||||
}.onFailure {
|
||||
} catch {
|
||||
throw NoStackTraceException(appCtx.getString(R.string.wrong_format))
|
||||
}
|
||||
bookSources
|
||||
|
||||
Reference in New Issue
Block a user