Strip filenames for visual media attachments during upload

This commit is contained in:
yash-signal
2025-06-09 11:46:55 -05:00
committed by GitHub
parent 9d5ab04195
commit 4a6e2d297b
3 changed files with 11 additions and 6 deletions

View File

@@ -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,