improving the SD card permission path check

This commit is contained in:
tibbi 2019-09-12 20:17:36 +02:00
parent 3dd16a32b4
commit 271bc43f4f
2 changed files with 3 additions and 3 deletions

View file

@ -7,7 +7,7 @@ buildscript {
propMinSdkVersion = 21
propTargetSdkVersion = propCompileSdkVersion
propVersionCode = 1
propVersionName = '5.17.13'
propVersionName = '5.17.16'
kotlin_version = '1.3.50'
}

View file

@ -183,7 +183,7 @@ abstract class BaseSimpleActivity : AppCompatActivity() {
val sdOtgPattern = Pattern.compile(SD_OTG_SHORT)
if (requestCode == OPEN_DOCUMENT_TREE && resultCode == Activity.RESULT_OK && resultData != null && resultData.data != null) {
val isProperPartition = partition.isEmpty() || (sdOtgPattern.matcher(partition).matches() && resultData.dataString!!.contains(partition))
val isProperPartition = partition.isEmpty() || !sdOtgPattern.matcher(partition).matches() || (sdOtgPattern.matcher(partition).matches() && resultData.dataString!!.contains(partition))
if (isProperSDFolder(resultData.data!!) && isProperPartition) {
if (resultData.dataString == baseConfig.OTGTreeUri) {
toast(R.string.sd_card_usb_same)
@ -199,7 +199,7 @@ abstract class BaseSimpleActivity : AppCompatActivity() {
startActivityForResult(intent, requestCode)
}
} else if (requestCode == OPEN_DOCUMENT_TREE_OTG && resultCode == Activity.RESULT_OK && resultData != null && resultData.data != null) {
val isProperPartition = partition.isEmpty() || (sdOtgPattern.matcher(partition).matches() && resultData.dataString!!.contains(partition))
val isProperPartition = partition.isEmpty() || !sdOtgPattern.matcher(partition).matches() || (sdOtgPattern.matcher(partition).matches() && resultData.dataString!!.contains(partition))
if (isProperOTGFolder(resultData.data!!) && isProperPartition) {
if (resultData.dataString == baseConfig.treeUri) {
funAfterSAFPermission?.invoke(false)