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>
t3chguy/dedup-icons-17oct
grimhilt 2023-01-03 07:53:33 +01:00 committed by GitHub
parent 1b06b72b67
commit 6ad70b0565
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 3 deletions

View File

@ -92,7 +92,7 @@ export default abstract class Exporter {
protected async downloadZIP(): Promise<string | void> {
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 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);
const content = await zip.generateAsync({ type: "blob" });
saveAs(content, filename);
saveAs(content, filenameWithoutExt + ".zip");
}
protected cleanUp(): string {