From 89ae540faab9f872372355227eb55463df944859 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 30 Jun 2022 16:22:52 +0100 Subject: [PATCH] Respect `filename` field on `m.file` events (#8951) --- src/customisations/models/IMediaEventContent.ts | 1 + src/utils/MediaEventHelper.ts | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/customisations/models/IMediaEventContent.ts b/src/customisations/models/IMediaEventContent.ts index 899d03f02d..d911a7cc3c 100644 --- a/src/customisations/models/IMediaEventContent.ts +++ b/src/customisations/models/IMediaEventContent.ts @@ -47,6 +47,7 @@ export interface IMediaEventInfo { export interface IMediaEventContent { body?: string; + filename?: string; // `m.file` optional field url?: string; // required on unencrypted media file?: IEncryptedFile; // required for *encrypted* media info?: IMediaEventInfo; diff --git a/src/utils/MediaEventHelper.ts b/src/utils/MediaEventHelper.ts index 80487eecc1..8f9aff48ec 100644 --- a/src/utils/MediaEventHelper.ts +++ b/src/utils/MediaEventHelper.ts @@ -47,7 +47,9 @@ export class MediaEventHelper implements IDestroyable { } public get fileName(): string { - return this.event.getContent().body || "download"; + return this.event.getContent().filename + || this.event.getContent().body + || "download"; } public destroy() {