@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.cjs CHANGED
@@ -356,7 +356,23 @@ function streamingUnzipSync(data, limits = DEFAULT_ZIP_LIMITS) {
356
356
  if (unsafePathHandling === "warn" && limits.onUnsafePath) {
357
357
  limits.onUnsafePath(file.name, reason);
358
358
  }
359
- file.ondata = () => {
359
+ file.ondata = (err, chunk, _final) => {
360
+ if (error) return;
361
+ if (err) {
362
+ error = err;
363
+ return;
364
+ }
365
+ if (chunk && chunk.length > 0) {
366
+ totalBytes += chunk.length;
367
+ if (totalBytes > limits.maxTotalSize) {
368
+ error = new ZipPreflightError(
369
+ `Total actual size ${totalBytes} exceeds limit ${limits.maxTotalSize}`,
370
+ totalBytes,
371
+ limits.maxTotalSize
372
+ );
373
+ file.terminate();
374
+ }
375
+ }
360
376
  };
361
377
  file.start();
362
378
  return;