Merge pull request #1875 from Bnyro/master

Show file type upon import failure
This commit is contained in:
Bnyro 2022-11-17 15:34:26 +01:00 committed by GitHub
commit 0b50606609
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -47,7 +47,8 @@ class ImportHelper(
* Get a list of channel IDs from a file [Uri] * Get a list of channel IDs from a file [Uri]
*/ */
private fun getChannelsFromUri(uri: Uri): List<String> { private fun getChannelsFromUri(uri: Uri): List<String> {
return when (activity.contentResolver.getType(uri)) { val fileType = activity.contentResolver.getType(uri)
return when (fileType) {
"application/json" -> { "application/json" -> {
// NewPipe subscriptions format // NewPipe subscriptions format
val mapper = ObjectMapper() val mapper = ObjectMapper()
@ -70,7 +71,7 @@ class ImportHelper(
} }
}.orEmpty() }.orEmpty()
} }
else -> throw IllegalArgumentException("Unsupported file type") else -> throw IllegalArgumentException("Unsupported file type: $fileType")
} }
} }