mirror of
https://github.com/aniyomiorg/aniyomi.git
synced 2024-11-28 09:15:12 +03:00
Discard backup file if it fails to be created properly (e.g. fails validation)
This commit is contained in:
parent
d5015d37e1
commit
76d2c676fd
1 changed files with 3 additions and 1 deletions
|
@ -59,8 +59,9 @@ class FullBackupManager(context: Context) : AbstractBackupManager(context) {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var file: UniFile? = null
|
||||||
try {
|
try {
|
||||||
val file: UniFile = (
|
file = (
|
||||||
if (isJob) {
|
if (isJob) {
|
||||||
// Get dir of file and create
|
// Get dir of file and create
|
||||||
var dir = UniFile.fromUri(context, uri)
|
var dir = UniFile.fromUri(context, uri)
|
||||||
|
@ -93,6 +94,7 @@ class FullBackupManager(context: Context) : AbstractBackupManager(context) {
|
||||||
return fileUri.toString()
|
return fileUri.toString()
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
logcat(LogPriority.ERROR, e)
|
logcat(LogPriority.ERROR, e)
|
||||||
|
file?.delete()
|
||||||
throw e
|
throw e
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue