From 4f560717869f5ac9fe0b1626cedf3ce5affce74b Mon Sep 17 00:00:00 2001 From: arkon Date: Thu, 28 Oct 2021 22:33:50 -0400 Subject: [PATCH] Validate backup during creation --- .../kanade/tachiyomi/data/backup/full/FullBackupManager.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/full/FullBackupManager.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/full/FullBackupManager.kt index 03984b12d..c334bcd21 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/full/FullBackupManager.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/full/FullBackupManager.kt @@ -85,7 +85,12 @@ class FullBackupManager(context: Context) : AbstractBackupManager(context) { val byteArray = parser.encodeToByteArray(BackupSerializer, backup!!) file.openOutputStream().sink().gzip().buffer().use { it.write(byteArray) } - return file.uri.toString() + val fileUri = file.uri + + // Validate it to make sure it works + FullBackupRestoreValidator().validate(context, fileUri) + + return fileUri.toString() } catch (e: Exception) { logcat(LogPriority.ERROR, e) throw e