Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Add root folder to zip file created by export chat feature (#7097)
Browse files Browse the repository at this point in the history
Signed-off-by: Aaron Raimist <[email protected]>
  • Loading branch information
aaronraimist authored Nov 15, 2021
1 parent bafeb38 commit 6d79b95
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/utils/exportUtils/Exporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,16 @@ export default abstract class Exporter {

protected async downloadZIP(): Promise<string | void> {
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();
// Create a writable stream to the directory
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" });

Expand Down

0 comments on commit 6d79b95

Please sign in to comment.