Commit fc328f1
fs: nullish coalescing to respect zero positional reads
When the file read position is moved passing zero is
not respected and `null` is used instead. PR fixes the
issues by using nullish coalescing which will return
the rhs only when the lhs is `null` or `undefined`;
respecting the zero.
Fixes: #40715
PR-URL: #40716
Fixes: #40699
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Evan Lucas <evanlucas@me.com>1 parent 0231ffa commit fc328f1Copy full SHA for fc328f1
File tree
Expand file treeCollapse file tree
2 files changed
+20
-1
lines changedOpen diff view settings
Filter options
- lib/internal/fs
- test/parallel
Expand file treeCollapse file tree
2 files changed
+20
-1
lines changedOpen diff view settings
Collapse file
lib/internal/fs/promises.js
Copy file name to clipboardExpand all lines: lib/internal/fs/promises.js+1-1Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
399 | 399 | |
400 | 400 | |
401 | 401 | |
402 | | - |
| 402 | + |
403 | 403 | |
404 | 404 | |
405 | 405 | |
|
Collapse file
test/parallel/test-fs-promises-file-handle-read.js
Copy file name to clipboardExpand all lines: test/parallel/test-fs-promises-file-handle-read.js+19Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
68 | 68 | |
69 | 69 | |
70 | 70 | |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | + |
| 77 | + |
| 78 | + |
| 79 | + |
| 80 | + |
| 81 | + |
| 82 | + |
| 83 | + |
| 84 | + |
| 85 | + |
| 86 | + |
| 87 | + |
| 88 | + |
71 | 89 | |
72 | 90 | |
73 | 91 | |
| ||
80 | 98 | |
81 | 99 | |
82 | 100 | |
| 101 | + |
83 | 102 | |
0 commit comments