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>pull/28788/head^2
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…
Reference in New Issue