Commit c74be8e
fix: import Transform from node:stream to fix ReferenceError on unencoded requests (#1069)
* fix: prevent file handle leak when maxFiles is exceeded
Fixes #987
When maxFiles limit is reached, the fileBegin event handler calls _error(),
but _handlePart continues and opens a write stream for the new file.
These file handles are never closed.
Fix: check this.error after emitting fileBegin and before file.open().
If an error occurred (e.g., maxFiles exceeded), decrement _flushing
and return early to prevent the file stream from being opened.
* fix: import Transform from node:stream to fix ReferenceError on unencoded requests
Fixes #1063
The compression support switch (commit 1a7f4a9) references
in the default case, but
is never imported. Every request without a Content-Encoding
header throws .
Changes:
- Add
- Use instead of
* fix: use ESM imports for node:zlib instead of require()
The module uses 'type': "module" in package.json, so require() is not
available. Replace all require('zlib') calls with proper ESM imports
(createGunzip, createInflate, createBrotliDecompress, createUnzip).
This fixes #1063 more completely:
- The node_stream Transform import from previous commit fixes the
ReferenceError for uncompressed requests
- This commit fixes ReferenceError: require is not defined for
compressed requests (gzip, deflate, br, compress)
---------
Co-authored-by: guoyangzhen <guoyangzhen@users.noreply.github.com>
Co-authored-by: tunnckoCore <5038030+tunnckoCore@users.noreply.github.com>1 parent cf9abfe commit c74be8e
1 file changed
Lines changed: 16 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | 9 | | |
11 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
12 | 18 | | |
13 | 19 | | |
14 | 20 | | |
| |||
262 | 268 | | |
263 | 269 | | |
264 | 270 | | |
265 | | - | |
| 271 | + | |
266 | 272 | | |
267 | 273 | | |
268 | | - | |
| 274 | + | |
269 | 275 | | |
270 | 276 | | |
271 | | - | |
| 277 | + | |
272 | 278 | | |
273 | 279 | | |
274 | | - | |
| 280 | + | |
275 | 281 | | |
276 | 282 | | |
277 | | - | |
278 | | - | |
279 | | - | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
280 | 286 | | |
281 | | - | |
282 | | - | |
283 | | - | |
| 287 | + | |
| 288 | + | |
284 | 289 | | |
285 | 290 | | |
286 | 291 | | |
| |||
0 commit comments