Skip to content

Commit 4a60c8b

Browse files
fix: zip size not being calculated correctly
somehow adding a zip with entries using the `adm-zip` constructor differs from adding the zip entries using the `addFile` method If I use the constructor to create the zip, and then send that zip to the server I was receiving the error `invalid entry size (expected 2187395080 but got 158 bytes)` [EMA-4088]
1 parent 71ef0cf commit 4a60c8b

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/services/action-flow/action-flow-service.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,19 @@ import * as fs from "fs";
99
class ActionFlowService {
1010
public async exportActionFlows(packageId: string, metadataFilePath: string): Promise<void> {
1111
const exportedActionFlowsData = await actionFlowApi.exportRawAssets(packageId);
12-
const exportedActionFlowsZip: AdmZip = new AdmZip(exportedActionFlowsData);
12+
const tmpZip: AdmZip = new AdmZip(exportedActionFlowsData);
13+
14+
const zip = new AdmZip();
15+
tmpZip.getEntries().forEach(entry => {
16+
zip.addFile(entry.entryName, entry.getData());
17+
});
1318

1419
if (metadataFilePath) {
15-
this.attachMetadataFile(metadataFilePath, exportedActionFlowsZip);
20+
this.attachMetadataFile(metadataFilePath, zip);
1621
}
1722

1823
const fileName = "export_action-flows_" + uuidv4() + ".zip";
19-
exportedActionFlowsZip.writeZip(fileName);
24+
zip.writeZip(fileName);
2025
logger.info(FileService.fileDownloadedMessage + fileName);
2126
}
2227

0 commit comments

Comments
 (0)