You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-04 11:51:45 +03:00
Fix export with attachments on formats txt and json (#9851)
* set file extension to .zip when needed * Apply prettier formatting Co-authored-by: grimhilt <grimhilt@users.noreply.github.com>
This commit is contained in:
@@ -92,7 +92,7 @@ export default abstract class Exporter {
|
|||||||
|
|
||||||
protected async downloadZIP(): Promise<string | void> {
|
protected async downloadZIP(): Promise<string | void> {
|
||||||
const filename = this.destinationFileName;
|
const filename = this.destinationFileName;
|
||||||
const filenameWithoutExt = filename.substring(0, filename.length - 4); // take off the .zip
|
const filenameWithoutExt = filename.substring(0, filename.lastIndexOf(".")); // take off the extension
|
||||||
const { default: JSZip } = await import("jszip");
|
const { default: JSZip } = await import("jszip");
|
||||||
|
|
||||||
const zip = new JSZip();
|
const zip = new JSZip();
|
||||||
@@ -103,8 +103,7 @@ export default abstract class Exporter {
|
|||||||
for (const file of this.files) zip.file(filenameWithoutExt + "/" + file.name, file.blob);
|
for (const file of this.files) zip.file(filenameWithoutExt + "/" + file.name, file.blob);
|
||||||
|
|
||||||
const content = await zip.generateAsync({ type: "blob" });
|
const content = await zip.generateAsync({ type: "blob" });
|
||||||
|
saveAs(content, filenameWithoutExt + ".zip");
|
||||||
saveAs(content, filename);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected cleanUp(): string {
|
protected cleanUp(): string {
|
||||||
|
|||||||
Reference in New Issue
Block a user