Commit c1a8a28
committed
fix(archives): normalize ENOENT surface across zip/tar/tar.gz
Before: `extractZip` on a missing path surfaced adm-zip's generic
`"ADM-ZIP: Invalid filename"` (no path, no error code), while
`extractTar` and `extractTarGz` surfaced the raw Node-level
`ENOENT: no such file or directory, open '<path>'`. Callers
branching on `err.code === 'ENOENT'` (standard fs pattern) got
inconsistent behavior depending on archive format.
After: all three extractors call a new private `assertArchiveExists`
preflight that surfaces a Node-style Error with `code: 'ENOENT'`,
`path: archivePath`, and a message that includes the path. The
preflight runs BEFORE the underlying extractor ever sees the
archive, so the ENOENT path is identical across zip, tar, tar.gz,
and the `extractArchive` dispatcher.
Tests:
- Three `.rejects.toThrow()` assertions that only verified *some*
rejection happened are now `.rejects.toMatchObject({ code:
'ENOENT', message: stringContaining(path) })` — they now catch
a semantic regression (e.g. silent success, wrong error) rather
than passing on any thrown value.
Misc:
- `scripts/build-externals/config.mts` — comment referenced the
removed `@socketsecurity/lib/validation/validate-schema` path;
updated to `@socketsecurity/lib/schema/validate`.
All 38 archive tests + 6327 full-suite tests pass.1 parent 00c8afa commit c1a8a28
3 files changed
Lines changed: 65 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
90 | | - | |
| 89 | + | |
| 90 | + | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
112 | 135 | | |
113 | 136 | | |
114 | 137 | | |
| |||
199 | 222 | | |
200 | 223 | | |
201 | 224 | | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
202 | 230 | | |
203 | 231 | | |
204 | 232 | | |
| |||
331 | 359 | | |
332 | 360 | | |
333 | 361 | | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
334 | 365 | | |
335 | 366 | | |
336 | 367 | | |
| |||
463 | 494 | | |
464 | 495 | | |
465 | 496 | | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
466 | 501 | | |
467 | 502 | | |
468 | 503 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
246 | | - | |
| 246 | + | |
247 | 247 | | |
248 | 248 | | |
249 | | - | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
250 | 261 | | |
251 | 262 | | |
252 | 263 | | |
| |||
321 | 332 | | |
322 | 333 | | |
323 | 334 | | |
324 | | - | |
| 335 | + | |
325 | 336 | | |
326 | 337 | | |
327 | | - | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
328 | 344 | | |
329 | 345 | | |
330 | 346 | | |
| |||
421 | 437 | | |
422 | 438 | | |
423 | 439 | | |
424 | | - | |
| 440 | + | |
425 | 441 | | |
426 | 442 | | |
427 | | - | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
428 | 449 | | |
429 | 450 | | |
430 | 451 | | |
| |||
0 commit comments