diff --git a/src/DateUtils.ts b/src/DateUtils.ts index e629782d6f..4bfe575e3c 100644 --- a/src/DateUtils.ts +++ b/src/DateUtils.ts @@ -137,7 +137,6 @@ export function wantsDateSeparator(prevEventDate: Date, nextEventDate: Date): bo return prevEventDate.getDay() !== nextEventDate.getDay(); } - export function formatFullDateNoDay(date: Date) { return ( date.getFullYear() + diff --git a/src/components/views/messages/MFileBody.js b/src/components/views/messages/MFileBody.js index 19b8d7342b..8afd4abaf6 100644 --- a/src/components/views/messages/MFileBody.js +++ b/src/components/views/messages/MFileBody.js @@ -176,7 +176,9 @@ export default class MFileBody extends React.Component { placeholder = (
- {this.props.isExporting ? : null} + {this.props.isExporting ? + + : null} {this.presentableTextForFile(content, false)}
diff --git a/src/utils/exportUtils/HtmlExport.tsx b/src/utils/exportUtils/HtmlExport.tsx index d5a4220304..47b318c409 100644 --- a/src/utils/exportUtils/HtmlExport.tsx +++ b/src/utils/exportUtils/HtmlExport.tsx @@ -156,7 +156,9 @@ export default class HTMLExporter extends Exporter { try { const isEncrypted = event.isEncrypted(); const content = event.getContent(); - if (isEncrypted && !content.hasOwnProperty("org.matrix.msc1767.file")) { + const shouldDecrypt = isEncrypted && !content.hasOwnProperty("org.matrix.msc1767.file") + && event.getType() !== "m.sticker"; + if (shouldDecrypt) { blob = await decryptFile(content.file); } else { const media = mediaFromContent(event.getContent()); @@ -185,7 +187,7 @@ export default class HTMLExporter extends Exporter { if (lastDot === -1) return [file, ""]; const fileName = file.slice(0, lastDot); const ext = file.slice(lastDot + 1); - return [fileName, ext]; + return [fileName, '.' + ext]; } protected getFilePath(event: MatrixEvent) { @@ -202,12 +204,11 @@ export default class HTMLExporter extends Exporter { fileDirectory = "audio"; break; default: - fileDirectory = "files"; - break; + fileDirectory = event.getType() === "m.sticker" ? "stickers" : "files"; } const fileDate = formatFullDateNoDay(new Date(event.getTs())); const [fileName, fileExt] = this.splitFileName(event.getContent().body); - const filePath = fileDirectory + "/" + fileName + '-' + fileDate + '.' + fileExt; + const filePath = fileDirectory + "/" + fileName + '-' + fileDate + fileExt; return filePath; }