From 0c1568308778a82b24ed0750a9be6e3164c35fcd Mon Sep 17 00:00:00 2001 From: Aaron Raimist Date: Mon, 8 Nov 2021 15:22:37 +0000 Subject: [PATCH] Add root folder to zip file created by export chat feature Signed-off-by: Aaron Raimist --- src/utils/exportUtils/Exporter.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/utils/exportUtils/Exporter.ts b/src/utils/exportUtils/Exporter.ts index b23c1153e04..7861e5ce9a3 100644 --- a/src/utils/exportUtils/Exporter.ts +++ b/src/utils/exportUtils/Exporter.ts @@ -77,7 +77,8 @@ export default abstract class Exporter { protected async downloadZIP(): Promise { const brand = SdkConfig.get().brand; - const filename = `${brand} - Chat Export - ${formatFullDateNoDay(new Date())}.zip`; + const filenameWithoutExt = `${brand} - Chat Export - ${formatFullDateNoDay(new Date())}`; + const filename = `${filenameWithoutExt}.zip`; const { default: JSZip } = await import('jszip'); const zip = new JSZip(); @@ -85,7 +86,7 @@ export default abstract class Exporter { if (!this.cancelled) this.updateProgress("Generating a ZIP"); else return this.cleanUp(); - for (const file of this.files) zip.file(file.name, file.blob); + for (const file of this.files) zip.file(filenameWithoutExt + "/" + file.name, file.blob); const content = await zip.generateAsync({ type: "blob" });