Do not fail backup creation when sticker files are missing.

This commit is contained in:
Cody Henthorne
2022-08-11 11:25:36 -04:00
parent 1e691005c7
commit ac8a972c6e
2 changed files with 7 additions and 4 deletions

View File

@@ -58,9 +58,7 @@ public enum BackupFileIOError {
if (error != null) {
error.postNotification(context);
}
if (error == null) {
} else {
UNKNOWN.postNotification(context);
}
}

View File

@@ -54,6 +54,7 @@ import org.thoughtcrime.securesms.util.TextSecurePreferences;
import org.thoughtcrime.securesms.util.Util;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -376,9 +377,11 @@ public class FullBackupExporter extends FullBackupBase {
}
if (!TextUtils.isEmpty(data) && size > 0) {
EventBus.getDefault().post(new BackupEvent(BackupEvent.Type.PROGRESS, ++count, estimatedCount));
try (InputStream inputStream = openAttachmentStream(attachmentSecret, random, data)) {
EventBus.getDefault().post(new BackupEvent(BackupEvent.Type.PROGRESS, ++count, estimatedCount));
outputStream.write(new AttachmentId(rowId, uniqueId), inputStream, size);
} catch (FileNotFoundException e) {
Log.w(TAG, "Missing attachment: " + e.getMessage());
}
}
@@ -402,6 +405,8 @@ public class FullBackupExporter extends FullBackupBase {
EventBus.getDefault().post(new BackupEvent(BackupEvent.Type.PROGRESS, ++count, estimatedCount));
try (InputStream inputStream = ModernDecryptingPartInputStream.createFor(attachmentSecret, random, new File(data), 0)) {
outputStream.writeSticker(rowId, inputStream, size);
} catch (FileNotFoundException e) {
Log.w(TAG, "Missing sticker: " + e.getMessage());
}
}