From 70c2a863cca7984fec072913148fb4651e9644e4 Mon Sep 17 00:00:00 2001 From: Moxie Marlinspike Date: Thu, 24 May 2018 09:57:16 -0700 Subject: [PATCH] Correctly store backup Fixes #7831 --- src/org/thoughtcrime/securesms/jobs/LocalBackupJob.java | 4 ++-- src/org/thoughtcrime/securesms/util/StorageUtil.java | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/org/thoughtcrime/securesms/jobs/LocalBackupJob.java b/src/org/thoughtcrime/securesms/jobs/LocalBackupJob.java index f436cdde8c..e530548a94 100644 --- a/src/org/thoughtcrime/securesms/jobs/LocalBackupJob.java +++ b/src/org/thoughtcrime/securesms/jobs/LocalBackupJob.java @@ -52,7 +52,7 @@ public class LocalBackupJob extends ContextJob { try { String backupPassword = TextSecurePreferences.getBackupPassphrase(context); - File backupDirectory = StorageUtil.getBackupCacheDirectory(context); + File backupDirectory = StorageUtil.getBackupDirectory(context); String timestamp = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss", Locale.US).format(new Date()); String fileName = String.format("signal-%s.backup", timestamp); File backupFile = new File(backupDirectory, fileName); @@ -65,7 +65,7 @@ public class LocalBackupJob extends ContextJob { throw new IOException("Backup password is null"); } - File tempFile = File.createTempFile("backup", "tmp", context.getExternalCacheDir()); + File tempFile = File.createTempFile("backup", "tmp", StorageUtil.getBackupCacheDirectory(context)); FullBackupExporter.export(context, AttachmentSecretProvider.getInstance(context).getOrCreateAttachmentSecret(), diff --git a/src/org/thoughtcrime/securesms/util/StorageUtil.java b/src/org/thoughtcrime/securesms/util/StorageUtil.java index 2bcd34f0fe..3950c7a5aa 100644 --- a/src/org/thoughtcrime/securesms/util/StorageUtil.java +++ b/src/org/thoughtcrime/securesms/util/StorageUtil.java @@ -12,8 +12,7 @@ import org.thoughtcrime.securesms.database.NoExternalStorageException; import java.io.File; -public class StorageUtil -{ +public class StorageUtil { public static File getBackupDirectory(Context context) throws NoExternalStorageException { File storage = null; @@ -43,7 +42,6 @@ public class StorageUtil } } - return backups; }