Fix uncaught error in copyStickerToAttachments
This commit is contained in:
parent
0f9242670c
commit
0d5ef38e52
3 changed files with 15 additions and 4 deletions
|
@ -769,7 +769,9 @@ export async function copyStickerToAttachments(
|
||||||
size,
|
size,
|
||||||
} = await window.Signal.Migrations.copyIntoAttachmentsDirectory(absolutePath);
|
} = await window.Signal.Migrations.copyIntoAttachmentsDirectory(absolutePath);
|
||||||
|
|
||||||
const data = window.Signal.Migrations.loadAttachmentData(path);
|
const { data } = await window.Signal.Migrations.loadAttachmentData({
|
||||||
|
path,
|
||||||
|
});
|
||||||
|
|
||||||
let contentType: MIMEType;
|
let contentType: MIMEType;
|
||||||
const sniffedMimeType = sniffImageMimeType(data);
|
const sniffedMimeType = sniffImageMimeType(data);
|
||||||
|
|
|
@ -2222,7 +2222,7 @@ export class ConversationView extends window.Backbone.View<ConversationModel> {
|
||||||
}
|
}
|
||||||
|
|
||||||
const absolutePath = getAbsoluteAttachmentPath(firstAttachment.path);
|
const absolutePath = getAbsoluteAttachmentPath(firstAttachment.path);
|
||||||
const tempPath = await copyIntoTempDirectory(absolutePath);
|
const { path: tempPath } = await copyIntoTempDirectory(absolutePath);
|
||||||
const tempAttachment = {
|
const tempAttachment = {
|
||||||
...firstAttachment,
|
...firstAttachment,
|
||||||
path: tempPath,
|
path: tempPath,
|
||||||
|
|
13
ts/window.d.ts
vendored
13
ts/window.d.ts
vendored
|
@ -303,7 +303,14 @@ declare global {
|
||||||
writeNewAttachmentData: (data: Uint8Array) => Promise<string>;
|
writeNewAttachmentData: (data: Uint8Array) => Promise<string>;
|
||||||
deleteExternalMessageFiles: (attributes: unknown) => Promise<void>;
|
deleteExternalMessageFiles: (attributes: unknown) => Promise<void>;
|
||||||
getAbsoluteAttachmentPath: (path: string) => string;
|
getAbsoluteAttachmentPath: (path: string) => string;
|
||||||
loadAttachmentData: (attachment: WhatIsThis) => WhatIsThis;
|
loadAttachmentData: <T extends { path?: string }>(
|
||||||
|
attachment: T
|
||||||
|
) => Promise<
|
||||||
|
T & {
|
||||||
|
data: Uint8Array;
|
||||||
|
size: number;
|
||||||
|
}
|
||||||
|
>;
|
||||||
loadQuoteData: (quote: unknown) => WhatIsThis;
|
loadQuoteData: (quote: unknown) => WhatIsThis;
|
||||||
loadPreviewData: (preview: unknown) => WhatIsThis;
|
loadPreviewData: (preview: unknown) => WhatIsThis;
|
||||||
loadStickerData: (sticker: unknown) => WhatIsThis;
|
loadStickerData: (sticker: unknown) => WhatIsThis;
|
||||||
|
@ -332,7 +339,9 @@ declare global {
|
||||||
attachment: DownloadedAttachmentType
|
attachment: DownloadedAttachmentType
|
||||||
) => Promise<DownloadedAttachmentType>;
|
) => Promise<DownloadedAttachmentType>;
|
||||||
|
|
||||||
copyIntoTempDirectory: any;
|
copyIntoTempDirectory: (
|
||||||
|
path: string
|
||||||
|
) => Promise<{ path: string; size: number }>;
|
||||||
deleteDraftFile: (path: string) => Promise<void>;
|
deleteDraftFile: (path: string) => Promise<void>;
|
||||||
deleteTempFile: (path: string) => Promise<void>;
|
deleteTempFile: (path: string) => Promise<void>;
|
||||||
getAbsoluteDraftPath: any;
|
getAbsoluteDraftPath: any;
|
||||||
|
|
Loading…
Reference in a new issue