diff --git a/ts/messageModifiers/AttachmentDownloads.ts b/ts/messageModifiers/AttachmentDownloads.ts index f08e7af40e..1fffa349ea 100644 --- a/ts/messageModifiers/AttachmentDownloads.ts +++ b/ts/messageModifiers/AttachmentDownloads.ts @@ -221,6 +221,7 @@ async function _maybeStartJob(): Promise { const logId = `attachment_downloads/_maybeStartJob/postProcess/${job.id}`; try { await promise; + log.info(`${logId}: job has finished running`); if (_activeAttachmentDownloadJobs[job.id]) { throw new Error( `${logId}: Active attachments jobs list still has this job!` @@ -341,6 +342,10 @@ async function _runJob(job?: AttachmentDownloadJobType): Promise { return; } + logger.info( + `attachment_downloads/_runJob(${id}): processing new attachment` + + ` of type: ${type}` + ); const upgradedAttachment = await window.Signal.Migrations.processNewAttachment(downloaded); @@ -470,6 +475,10 @@ async function _finishJob( await saveMessage(message.attributes, { ourAci: window.textsecure.storage.user.getCheckedAci(), }); + } else { + logger.info( + `attachment_downloads/_finishJob for job id: ${id} without message` + ); } await removeAttachmentDownloadJob(id); @@ -516,6 +525,8 @@ async function _addAttachmentToMessage( const logPrefix = `${message.idForLogging()} (type: ${type}, index: ${index})`; const attachmentSignature = getAttachmentSignature(attachment); + log.info(`${logPrefix}: _addAttachmentToMessage: starting`); + if (type === 'long-message') { let handledAnywhere = false; let attachmentData: Uint8Array | undefined; @@ -601,6 +612,7 @@ async function _addAttachmentToMessage( `${logPrefix}: Long message attachment found no matching place to apply` ); } + log.info(`${logPrefix}: _addAttachmentToMessage finished`); } return; } diff --git a/ts/textsecure/downloadAttachment.ts b/ts/textsecure/downloadAttachment.ts index 91ed0590e1..e97230b892 100644 --- a/ts/textsecure/downloadAttachment.ts +++ b/ts/textsecure/downloadAttachment.ts @@ -100,8 +100,11 @@ export async function downloadAttachmentV2( dropNull(cdnNumber), options ); + log.info(`${logId} got download stream`); const cipherTextRelativePath = await downloadToDisk({ downloadStream, size }); + log.info(`${logId} downloaded encrypted file to disk`); + const cipherTextAbsolutePath = window.Signal.Migrations.getAbsoluteAttachmentPath(cipherTextRelativePath); @@ -112,6 +115,7 @@ export async function downloadAttachmentV2( size, theirDigest: Bytes.fromBase64(digest), }); + log.info(`${logId} successfully decrypted`); safeUnlinkSync(cipherTextAbsolutePath); diff --git a/ts/types/Attachment.ts b/ts/types/Attachment.ts index 6e3891d9b6..6b5e469738 100644 --- a/ts/types/Attachment.ts +++ b/ts/types/Attachment.ts @@ -413,15 +413,19 @@ export async function captureDimensionsAndScreenshot( if (!attachment.path) { return attachment; } + logger.info('captureDimensionsAndScreenshot: starting'); const absolutePath = getAbsoluteAttachmentPath(attachment.path); if (GoogleChrome.isImageTypeSupported(contentType)) { try { + logger.info('captureDimensionsAndScreenshot: getting image dimensions'); const { width, height } = await getImageDimensionsFromURL({ objectUrl: absolutePath, logger, }); + + logger.info('captureDimensionsAndScreenshot: generating thumbnail'); const thumbnailBuffer = await blobToArrayBuffer( await makeImageThumbnail({ size: THUMBNAIL_SIZE, @@ -430,7 +434,7 @@ export async function captureDimensionsAndScreenshot( logger, }) ); - + logger.info('captureDimensionsAndScreenshot: writing thumbnail'); const thumbnailPath = await writeNewAttachmentData( new Uint8Array(thumbnailBuffer) ); @@ -457,6 +461,7 @@ export async function captureDimensionsAndScreenshot( let screenshotObjectUrl: string | undefined; try { + logger.info('captureDimensionsAndScreenshot: making video screenshot'); const screenshotBuffer = await blobToArrayBuffer( await makeVideoScreenshot({ objectUrl: absolutePath, @@ -468,14 +473,17 @@ export async function captureDimensionsAndScreenshot( screenshotBuffer, THUMBNAIL_CONTENT_TYPE ); + logger.info('captureDimensionsAndScreenshot: getting image dimensions'); const { width, height } = await getImageDimensionsFromURL({ objectUrl: screenshotObjectUrl, logger, }); + logger.info('captureDimensionsAndScreenshot: writing attachment data'); const screenshotPath = await writeNewAttachmentData( new Uint8Array(screenshotBuffer) ); + logger.info('captureDimensionsAndScreenshot: making thumbnail'); const thumbnailBuffer = await blobToArrayBuffer( await makeImageThumbnail({ size: THUMBNAIL_SIZE, @@ -485,6 +493,7 @@ export async function captureDimensionsAndScreenshot( }) ); + logger.info('captureDimensionsAndScreenshot: writing thumbnail'); const thumbnailPath = await writeNewAttachmentData( new Uint8Array(thumbnailBuffer) );