diff --git a/ts/components/Lightbox.tsx b/ts/components/Lightbox.tsx index 4a80f806c4..95eafb5c0e 100644 --- a/ts/components/Lightbox.tsx +++ b/ts/components/Lightbox.tsx @@ -605,7 +605,7 @@ export function Lightbox({ {i18n('icu:lightboxImageAlt')}) => { // These are the only image types supported by Electron's NativeImage if ( diff --git a/ts/test-mock/messaging/lightbox_test.ts b/ts/test-mock/messaging/lightbox_test.ts index 3aeefdbd0b..db7ecd783d 100644 --- a/ts/test-mock/messaging/lightbox_test.ts +++ b/ts/test-mock/messaging/lightbox_test.ts @@ -134,9 +134,11 @@ describe('lightbox', function (this: Mocha.Suite) { async function expectLightboxImage( attachment: SignalService.IAttachmentPointer ) { - strictAssert(attachment.fileName, 'Must have filename'); - const Object = LightboxContent.getByTestId(attachment.fileName); - debug(`Waiting for ${attachment.fileName}`); + debug('attachment cdnKey is', typeof attachment.cdnKey); + strictAssert(attachment.cdnKey, 'Must have cdnKey'); + strictAssert(attachment.cdnKey.length > 0, 'Must have valid cdnKey'); + const Object = LightboxContent.getByTestId(attachment.cdnKey); + debug(`Waiting for attachment with cdnKey ${attachment.cdnKey}`); await expect(Object).toBeVisible(); } diff --git a/ts/util/uploadAttachment.ts b/ts/util/uploadAttachment.ts index 8bf22f54f3..75234e226b 100644 --- a/ts/util/uploadAttachment.ts +++ b/ts/util/uploadAttachment.ts @@ -22,6 +22,7 @@ import { } from '../AttachmentCrypto'; import { missingCaseError } from './missingCaseError'; import { uuidToBytes } from './uuidToBytes'; +import { isVisualMedia } from '../types/Attachment'; const CDNS_SUPPORTING_TUS = new Set([3]); @@ -42,8 +43,10 @@ export async function uploadAttachment( uploadType: 'standard', }); - const { blurHash, caption, clientUuid, fileName, flags, height, width } = - attachment; + const { blurHash, caption, clientUuid, flags, height, width } = attachment; + + // Strip filename for visual media (images and videos) to prevent metadata leakage + const fileName = isVisualMedia(attachment) ? undefined : attachment.fileName; return { cdnKey,