mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
fix(ext/node): map ERROR_INVALID_NAME
to ENOENT
on windows (#26475)
In libuv on windows, `ERROR_INVALID_NAME` is mapped to `ENOENT`, but it
is mapped to `EINVAL` in our compat implementation, which causes the
issue #24899.
ref:
d4ab6fbba4/src/win/error.c (L138)
closes #24899
closes #26411
closes #23635
closes #21165
closes #19067
This commit is contained in:
parent
5e020ebc35
commit
285635daa6
2 changed files with 12 additions and 1 deletions
|
@ -62,7 +62,7 @@ pub fn op_node_sys_to_uv_error(err: i32) -> String {
|
||||||
WSAEHOSTUNREACH => "EHOSTUNREACH",
|
WSAEHOSTUNREACH => "EHOSTUNREACH",
|
||||||
ERROR_INSUFFICIENT_BUFFER => "EINVAL",
|
ERROR_INSUFFICIENT_BUFFER => "EINVAL",
|
||||||
ERROR_INVALID_DATA => "EINVAL",
|
ERROR_INVALID_DATA => "EINVAL",
|
||||||
ERROR_INVALID_NAME => "EINVAL",
|
ERROR_INVALID_NAME => "ENOENT",
|
||||||
ERROR_INVALID_PARAMETER => "EINVAL",
|
ERROR_INVALID_PARAMETER => "EINVAL",
|
||||||
WSAEINVAL => "EINVAL",
|
WSAEINVAL => "EINVAL",
|
||||||
WSAEPFNOSUPPORT => "EINVAL",
|
WSAEPFNOSUPPORT => "EINVAL",
|
||||||
|
|
|
@ -233,3 +233,14 @@ Deno.test("[node/fs] copyFile COPYFILE_EXCL works", async () => {
|
||||||
copyFileSync(src, dest2, fsPromiseConstants.COPYFILE_EXCL)
|
copyFileSync(src, dest2, fsPromiseConstants.COPYFILE_EXCL)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Deno.test("[node/fs] statSync throws ENOENT for invalid path containing colon in it", () => {
|
||||||
|
// deno-lint-ignore no-explicit-any
|
||||||
|
const err: any = assertThrows(() => {
|
||||||
|
// Note: Deno.stat throws ERROR_INVALID_NAME (os error 123) instead of
|
||||||
|
// ERROR_FILE_NOT_FOUND (os error 2) on windows. This case checks that
|
||||||
|
// ERROR_INVALID_NAME is mapped to ENOENT correctly on node compat layer.
|
||||||
|
statSync("jsr:@std/assert");
|
||||||
|
});
|
||||||
|
assertEquals(err.code, "ENOENT");
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in a new issue