Merge pull request #4466 from FineFindus/fix/import-google-takeout

fix(import): prevent crash when importing
This commit is contained in:
Bnyro 2023-08-14 15:00:56 +02:00 committed by GitHub
commit d6a3166e86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,6 +23,7 @@ import kotlin.streams.toList
import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.json.decodeFromStream import kotlinx.serialization.json.decodeFromStream
import kotlinx.serialization.json.encodeToStream import kotlinx.serialization.json.encodeToStream
import java.util.stream.Collectors
object ImportHelper { object ImportHelper {
/** /**
@ -79,7 +80,7 @@ object ImportHelper {
it.bufferedReader().use { reader -> it.bufferedReader().use { reader ->
reader.lines().map { line -> line.substringBefore(",") } reader.lines().map { line -> line.substringBefore(",") }
.filter { channelId -> channelId.length == 24 } .filter { channelId -> channelId.length == 24 }
.toList() .collect(Collectors.toList())
} }
}.orEmpty() }.orEmpty()
} }