From fd187a353c852904823b513c55826aa5c6a74fb9 Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Fri, 26 Jan 2024 16:21:01 -0800 Subject: [PATCH] Send attachment filenames for non-image/non-video quote attachments --- ts/jobs/helpers/sendNormalMessage.ts | 1 + ts/models/messages.ts | 16 +++++----------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/ts/jobs/helpers/sendNormalMessage.ts b/ts/jobs/helpers/sendNormalMessage.ts index 37e9f58a2587..2dff0414353f 100644 --- a/ts/jobs/helpers/sendNormalMessage.ts +++ b/ts/jobs/helpers/sendNormalMessage.ts @@ -793,6 +793,7 @@ async function uploadMessageQuote({ if (!thumbnail) { return { contentType: attachment.contentType, + fileName: attachment.fileName, }; } diff --git a/ts/models/messages.ts b/ts/models/messages.ts index af6feeddfc20..111cc6653c17 100644 --- a/ts/models/messages.ts +++ b/ts/models/messages.ts @@ -50,7 +50,6 @@ import * as reactionUtil from '../reactions/util'; import * as Errors from '../types/errors'; import type { AttachmentType } from '../types/Attachment'; import { isImage, isVideo } from '../types/Attachment'; -import { stringToMIMEType } from '../types/MIME'; import * as MIME from '../types/MIME'; import { ReadStatus } from '../messages/MessageReadStatus'; import type { SendStateByConversationId } from '../messages/MessageSendState'; @@ -1553,16 +1552,7 @@ export class MessageModel extends window.Backbone.Model { firstAttachment.thumbnail = null; } - if ( - !firstAttachment || - !firstAttachment.contentType || - (!GoogleChrome.isImageTypeSupported( - stringToMIMEType(firstAttachment.contentType) - ) && - !GoogleChrome.isVideoTypeSupported( - stringToMIMEType(firstAttachment.contentType) - )) - ) { + if (!firstAttachment || !firstAttachment.contentType) { return; } @@ -1599,6 +1589,10 @@ export class MessageModel extends window.Backbone.Model { ...thumbnail, copied: true, }; + } else { + firstAttachment.contentType = queryFirst.contentType; + firstAttachment.fileName = queryFirst.fileName; + firstAttachment.thumbnail = null; } }