mirror of
https://github.com/vector-im/element-web.git
synced 2025-08-19 13:31:24 +02: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:
parent
1b06b72b67
commit
6ad70b0565
@ -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 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user