safer decodeURIComponent(), fixes #277

This commit is contained in:
Aine
2025-01-17 09:42:21 +02:00
parent 2a5b59002e
commit df911c9e97
2 changed files with 5 additions and 2 deletions

View File

@@ -504,7 +504,10 @@ export const ReportMediaContent = ({ source }) => {
return null;
}
const uploadName = decodeURIComponent(get(record, "event_json.content.body")?.toString());
let uploadName = "";
if (get(record, "event_json.content.body")) {
uploadName = decodeURIComponent(get(record, "event_json.content.body")?.toString());
}
return <ViewMediaButton mxcURL={mxcURL} label={mxcURL} uploadName={uploadName} mimetype={record.media_type}/>;
};