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

Add root folder to zip file created by export chat feature #7097

Merged
merged 1 commit into from
Nov 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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