Discard backup file if it fails to be created properly (e.g. fails validation)
(cherry picked from commit 76d2c676fd2e11459952fd25e60b8bd0433ec164)
This commit is contained in:
parent
98ee328d1b
commit
0c4dc91e9e
1 changed files with 3 additions and 1 deletions
|
|
@ -82,8 +82,9 @@ class FullBackupManager(context: Context) : AbstractBackupManager(context) {
|
|||
)
|
||||
}
|
||||
|
||||
var file: UniFile? = null
|
||||
try {
|
||||
val file: UniFile = (
|
||||
file = (
|
||||
if (isJob) {
|
||||
// Get dir of file and create
|
||||
var dir = UniFile.fromUri(context, uri)
|
||||
|
|
@ -116,6 +117,7 @@ class FullBackupManager(context: Context) : AbstractBackupManager(context) {
|
|||
return fileUri.toString()
|
||||
} catch (e: Exception) {
|
||||
logcat(LogPriority.ERROR, e)
|
||||
file?.delete()
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue