@character-foundry/character-foundry 0.1.8 → 0.1.9-dev.1765913722

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/charx.js CHANGED
@@ -324,7 +324,23 @@ function streamingUnzipSync(data, limits = DEFAULT_ZIP_LIMITS) {
324
324
  if (unsafePathHandling === "warn" && limits.onUnsafePath) {
325
325
  limits.onUnsafePath(file.name, reason);
326
326
  }
327
- file.ondata = () => {
327
+ file.ondata = (err, chunk, _final) => {
328
+ if (error) return;
329
+ if (err) {
330
+ error = err;
331
+ return;
332
+ }
333
+ if (chunk && chunk.length > 0) {
334
+ totalBytes += chunk.length;
335
+ if (totalBytes > limits.maxTotalSize) {
336
+ error = new ZipPreflightError(
337
+ `Total actual size ${totalBytes} exceeds limit ${limits.maxTotalSize}`,
338
+ totalBytes,
339
+ limits.maxTotalSize
340
+ );
341
+ file.terminate();
342
+ }
343
+ }
328
344
  };
329
345
  file.start();
330
346
  return;