mirror of
https://github.com/android-password-store/Android-Password-Store.git
synced 2025-09-06 04:51:38 +02:00
Fix deletion of individual password files (#668)
Commit fde8137b
(#659) introduced a regression that results in Password Store crashing when the user tries to delete a single password file as opposed to a directory.
The root cause is a call of FileUtils.listFiles() on the selected item, which only works for directories.
The fix is to work with a list consisting only of the selected item if it happens to be a file.
This commit is contained in:
parent
a736dcc255
commit
de4cc63860
|
@ -499,7 +499,11 @@ class PasswordStore : AppCompatActivity() {
|
|||
MaterialAlertDialogBuilder(this)
|
||||
.setMessage(resources.getString(R.string.delete_dialog_text, item.longName))
|
||||
.setPositiveButton(resources.getString(R.string.dialog_yes)) { _, _ ->
|
||||
val filesToDelete = FileUtils.listFiles(item.file, null, true)
|
||||
val filesToDelete = if (item.file.isDirectory) {
|
||||
FileUtils.listFiles(item.file, null, true)
|
||||
} else {
|
||||
listOf(item.file)
|
||||
}
|
||||
AutofillMatcher.updateMatches(applicationContext, delete = filesToDelete)
|
||||
item.file.deleteRecursively()
|
||||
adapter.remove(position)
|
||||
|
|
Loading…
Reference in a new issue