remove the special OTG handling at ensurePublicUri

This commit is contained in:
tibbi 2019-02-16 14:09:38 +01:00
parent 06abb1d8b9
commit f509c8968c
2 changed files with 7 additions and 11 deletions

View file

@ -7,7 +7,7 @@ buildscript {
propMinSdkVersion = 21
propTargetSdkVersion = propCompileSdkVersion
propVersionCode = 1
propVersionName = '5.8.0'
propVersionName = '5.8.1'
kotlin_version = '1.3.21'
}

View file

@ -302,17 +302,13 @@ fun Context.getMimeTypeFromUri(uri: Uri): String {
}
fun Context.ensurePublicUri(path: String, applicationId: String): Uri? {
return if (isPathOnOTG(path)) {
getDocumentFile(path)?.uri
val uri = Uri.parse(path)
return if (uri.scheme == "content") {
uri
} else {
val uri = Uri.parse(path)
if (uri.scheme == "content") {
uri
} else {
val newPath = if (uri.toString().startsWith("/")) uri.toString() else uri.path
val file = File(newPath)
getFilePublicUri(file, applicationId)
}
val newPath = if (uri.toString().startsWith("/")) uri.toString() else uri.path
val file = File(newPath)
getFilePublicUri(file, applicationId)
}
}