Do not fail backup creation when sticker files are missing.

fork-5.53.8
Cody Henthorne 2022-08-11 11:25:36 -04:00
rodzic 1e691005c7
commit ac8a972c6e
2 zmienionych plików z 7 dodań i 4 usunięć

Wyświetl plik

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

Wyświetl plik

@ -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());
}
}