Commit 8452bc2
fix(fslib): handle float timestamps in convertToBigIntStats (#6988)
## Summary
Fixes RangeError when converting floating-point timestamps to BigInt in
the `convertToBigIntStats` function.
## Problem
The `convertToBigIntStats()` function fails when file stats contain
non-integer timestamps (e.g., `1763746784088.47`), throwing:
```
RangeError: The number 1763746784088.47 cannot be converted to a BigInt because it is not an integer
```
This occurs when ZIP file entries have timestamps with floating-point
precision, particularly observed in Yarn 6.0.0-rc.5 when building with
Storybook.
## Solution
Use `Math.floor()` to ensure integer values before BigInt conversion on
line 194 of `packages/yarnpkg-fslib/sources/statUtils.ts`.
## Changes
- Changed `BigInt(element)` to `BigInt(Math.floor(element))`
## Testing
- Tested with Yarn 6.0.0-rc.5 + Storybook build
- Verified the RangeError no longer occurs with floating-point
timestamps
## Related
This issue was discovered while running `yarn storybook build` with Yarn
6.0.0-rc.5.
---------
Co-authored-by: Maël Nison <[email protected]>1 parent a0a55cb commit 8452bc2
File tree
7 files changed
+63
-11
lines changed- .yarn/versions
- packages
- yarnpkg-fslib
- sources
- tests/fixtures
- yarnpkg-libzip/tests
- fixtures
- yarnpkg-pnp/sources
7 files changed
+63
-11
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
194 | | - | |
| 194 | + | |
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
206 | 206 | | |
207 | 207 | | |
208 | 208 | | |
| |||
Binary file not shown.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
20 | 24 | | |
21 | 25 | | |
22 | 26 | | |
23 | 27 | | |
24 | 28 | | |
| 29 | + | |
25 | 30 | | |
26 | 31 | | |
27 | 32 | | |
| |||
86 | 91 | | |
87 | 92 | | |
88 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
89 | 103 | | |
90 | 104 | | |
91 | 105 | | |
| |||
Binary file not shown.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments