Commit b5763ea
committed
Fix handling of absolute paths
This commit fixes the handling of absolute paths, switching from
`path.join()` to `path.isAbsolute()` to handle differing behavior for
different platforms.
`path.join()` works differently for Windows paths and Linux paths.
`path.join(".", "C:\\") === "C:\\"`
`path.join(".", "/home/test") === "home/test"`
The latter is missing a leading `/` and thus is no longer an
absolute path.
As described in [this issue](GHSA-37v4-cwgp-x353),
there was a NodeJS [security vulnerability](https://nodejs.org/en/blog/vulnerability/january-2025-security-releases)
that caused the behavior of `path.join()` to be changed. Newer versions
of Node will return a relative path in these instances, so
`path.join(".", "C:\\") === ".\\C:\\"`.1 parent fabcbb5 commit b5763ea
2 files changed
Lines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
207 | 207 | | |
208 | 208 | | |
209 | 209 | | |
210 | | - | |
| 210 | + | |
| 211 | + | |
211 | 212 | | |
212 | 213 | | |
213 | 214 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
| 180 | + | |
| 181 | + | |
180 | 182 | | |
181 | | - | |
| 183 | + | |
182 | 184 | | |
183 | 185 | | |
184 | 186 | | |
| |||
0 commit comments