From f3c326e6489e4e1cec8075c49c3ccf978a660f5b Mon Sep 17 00:00:00 2001 From: automated-signal <37887102+automated-signal@users.noreply.github.com> Date: Fri, 30 Jan 2026 15:59:39 -0600 Subject: [PATCH] Fix non-renderable media files losing filename on upload Co-authored-by: yash-signal --- ts/util/uploadAttachment.preload.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ts/util/uploadAttachment.preload.ts b/ts/util/uploadAttachment.preload.ts index 99cf41b5fa..0df5cf7752 100644 --- a/ts/util/uploadAttachment.preload.ts +++ b/ts/util/uploadAttachment.preload.ts @@ -28,7 +28,7 @@ import { import { missingCaseError } from './missingCaseError.std.js'; import { uuidToBytes } from './uuidToBytes.std.js'; import { DAY } from './durations/index.std.js'; -import { isVisualMedia } from './Attachment.std.js'; +import { isImageAttachment, isVideoAttachment } from './Attachment.std.js'; import { getAbsoluteAttachmentPath } from './migrations.preload.js'; import { isMoreRecentThan } from './timestamp.std.js'; @@ -90,8 +90,10 @@ export async function uploadAttachment( 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; + // Strip filename only for renderable visual media to prevent metadata leakage + const shouldStripFilename = + isImageAttachment(attachment) || isVideoAttachment(attachment); + const fileName = shouldStripFilename ? undefined : attachment.fileName; return { cdnKey,