Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Respect filename field on m.file events #8951

Merged
merged 1 commit into from
Jun 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/customisations/models/IMediaEventContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export interface IMediaEventInfo {

export interface IMediaEventContent {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little confused why this interface is here instead of in the js-sdk, but I guess that doesn't have to be a problem for right now

body?: string;
filename?: string; // `m.file` optional field
url?: string; // required on unencrypted media
file?: IEncryptedFile; // required for *encrypted* media
info?: IMediaEventInfo;
Expand Down
4 changes: 3 additions & 1 deletion src/utils/MediaEventHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ export class MediaEventHelper implements IDestroyable {
}

public get fileName(): string {
return this.event.getContent<IMediaEventContent>().body || "download";
return this.event.getContent<IMediaEventContent>().filename
|| this.event.getContent<IMediaEventContent>().body
|| "download";
}

public destroy() {
Expand Down