musikr.playlist: tolerate 3rd-party paths
This commit is contained in:
@@ -93,7 +93,7 @@ private class ExternalPlaylistManagerImpl(
|
|||||||
private val m3u: M3U,
|
private val m3u: M3U,
|
||||||
) : ExternalPlaylistManager {
|
) : ExternalPlaylistManager {
|
||||||
override suspend fun import(uri: Uri): ImportedPlaylist? {
|
override suspend fun import(uri: Uri): ImportedPlaylist? {
|
||||||
val filePath = documentPathFactory.unpackDocumentUri(uri) ?: return null
|
val filePath = documentPathFactory.unpackDocumentUri(uri) ?: Path(null, Components.root())
|
||||||
|
|
||||||
return try {
|
return try {
|
||||||
context.contentResolverSafe.openInputStream(uri)?.use {
|
context.contentResolverSafe.openInputStream(uri)?.use {
|
||||||
@@ -118,7 +118,7 @@ private class ExternalPlaylistManagerImpl(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun export(playlist: Playlist, uri: Uri, config: ExportConfig): Boolean {
|
override suspend fun export(playlist: Playlist, uri: Uri, config: ExportConfig): Boolean {
|
||||||
val filePath = documentPathFactory.unpackDocumentUri(uri) ?: return false
|
val filePath = documentPathFactory.unpackDocumentUri(uri) ?: Path(null, Components.root())
|
||||||
val workingDirectory =
|
val workingDirectory =
|
||||||
if (config.absolute) {
|
if (config.absolute) {
|
||||||
Path(filePath.volume, Components.parseUnix("/"))
|
Path(filePath.volume, Components.parseUnix("/"))
|
||||||
|
|||||||
Reference in New Issue
Block a user