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

Commit

Permalink
Respect filename field on m.file events (#8951)
Browse files Browse the repository at this point in the history
  • Loading branch information
t3chguy authored Jun 30, 2022
1 parent 328d7ea commit 89ae540
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
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 {
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

0 comments on commit 89ae540

Please sign in to comment.