android / android/security-samples
method encryptFile() has bug
- Dominant language
- Kotlin
- Stars
- 1k
- Forks
- 450
- PR merge metrics
- No merged PRs in 30d
Description
```
private fun encryptFile() {
val title = binding.titleEditText.text.toString()
val body = binding.bodyEditText.text.toString()
if (title.isBlank()) return
try {
deleteFile(existingFileTitle)
val encryptedFile = getEncryptedFile(title)
encryptedFile.openFileOutput().use { output ->
output.write(body.toByteArray())
}
} catch (e: Exception) {
e.printStackTrace()
showSnackbar(R.string.error_unable_to_save_file)
}
}
```
should change deleteFile(existingFileTitle) to deleteFile(title )
Contributor guide
Research direction
Locate encryptFile() in the Android sample and inspect the surrounding save or rename flow. Verify the deletion call against the title used to create the encrypted file, then exercise saving an edited file to confirm the obsolete file is removed and the new file remains.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- mobile-dev, security
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100