Make ensureAttachmentIsReencryptable migration resilient to missing attachments
This commit is contained in:
parent
a1be616e6f
commit
0e386ef705
5 changed files with 117 additions and 15 deletions
12
ts/signal.ts
12
ts/signal.ts
|
@ -79,6 +79,9 @@ type MigrationsModuleType = {
|
|||
deleteSticker: (path: string) => Promise<void>;
|
||||
deleteTempFile: (path: string) => Promise<void>;
|
||||
doesAttachmentExist: (path: string) => Promise<boolean>;
|
||||
ensureAttachmentIsReencryptable: (
|
||||
attachment: TypesAttachment.LocallySavedAttachment
|
||||
) => Promise<TypesAttachment.ReencryptableAttachment>;
|
||||
getAbsoluteAttachmentPath: (path: string) => string;
|
||||
getAbsoluteAvatarPath: (src: string) => string;
|
||||
getAbsoluteBadgeImageFilePath: (path: string) => string;
|
||||
|
@ -161,6 +164,7 @@ export function initializeMigrations({
|
|||
createPlaintextReader,
|
||||
createWriterForNew,
|
||||
createDoesExist,
|
||||
ensureAttachmentIsReencryptable,
|
||||
getAvatarsPath,
|
||||
getDraftPath,
|
||||
getDownloadsPath,
|
||||
|
@ -291,6 +295,7 @@ export function initializeMigrations({
|
|||
deleteSticker,
|
||||
deleteTempFile,
|
||||
doesAttachmentExist,
|
||||
ensureAttachmentIsReencryptable,
|
||||
getAbsoluteAttachmentPath,
|
||||
getAbsoluteAvatarPath,
|
||||
getAbsoluteBadgeImageFilePath,
|
||||
|
@ -313,6 +318,7 @@ export function initializeMigrations({
|
|||
processNewAttachment: (attachment: AttachmentType) =>
|
||||
MessageType.processNewAttachment(attachment, {
|
||||
writeNewAttachmentData,
|
||||
ensureAttachmentIsReencryptable,
|
||||
makeObjectUrl,
|
||||
revokeObjectUrl,
|
||||
getImageDimensions,
|
||||
|
@ -341,6 +347,8 @@ export function initializeMigrations({
|
|||
|
||||
return MessageType.upgradeSchema(message, {
|
||||
deleteOnDisk,
|
||||
doesAttachmentExist,
|
||||
ensureAttachmentIsReencryptable,
|
||||
getImageDimensions,
|
||||
getRegionCode,
|
||||
makeImageThumbnail,
|
||||
|
@ -350,7 +358,6 @@ export function initializeMigrations({
|
|||
revokeObjectUrl,
|
||||
writeNewAttachmentData,
|
||||
writeNewStickerData,
|
||||
|
||||
logger,
|
||||
maxVersion,
|
||||
});
|
||||
|
@ -404,6 +411,9 @@ type AttachmentsModuleType = {
|
|||
name: string;
|
||||
}) => Promise<null | { fullPath: string; name: string }>;
|
||||
|
||||
ensureAttachmentIsReencryptable: (
|
||||
attachment: TypesAttachment.LocallySavedAttachment
|
||||
) => Promise<TypesAttachment.ReencryptableAttachment>;
|
||||
readAndDecryptDataFromDisk: (options: {
|
||||
absolutePath: string;
|
||||
keysBase64: string;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue