diff options
author | 2023-09-17 03:51:18 +0200 | |
---|---|---|
committer | 2023-09-16 18:51:18 -0700 | |
commit | 0a318ecca14ab1e71aa60ae8eadbd16343b3a3ea (patch) | |
tree | 842c3ff3c6c22a1b7a8be0929f0fd0b88778158b /src | |
parent | 08426962fa0d4c2f4104d644f0767cb5f93cae65 (diff) | |
download | bun-0a318ecca14ab1e71aa60ae8eadbd16343b3a3ea.tar.gz bun-0a318ecca14ab1e71aa60ae8eadbd16343b3a3ea.tar.zst bun-0a318ecca14ab1e71aa60ae8eadbd16343b3a3ea.zip |
fix: node compatibility with empty path string (#4693)
Co-authored-by: MrPalixir <73360179+MrPalixir@users.noreply.github.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/bun.js/node/types.zig | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/bun.js/node/types.zig b/src/bun.js/node/types.zig index 84dc394d0..72f1dff7e 100644 --- a/src/bun.js/node/types.zig +++ b/src/bun.js/node/types.zig @@ -881,11 +881,7 @@ pub const Valid = struct { pub fn pathSlice(zig_str: JSC.ZigString.Slice, ctx: JSC.C.JSContextRef, exception: JSC.C.ExceptionRef) bool { switch (zig_str.len) { - 0 => { - JSC.throwInvalidArguments("Invalid path string: can't be empty", .{}, ctx, exception); - return false; - }, - 1...bun.MAX_PATH_BYTES => return true, + 0...bun.MAX_PATH_BYTES => return true, else => { // TODO: should this be an EINVAL? JSC.throwInvalidArguments( @@ -903,11 +899,7 @@ pub const Valid = struct { pub fn pathStringLength(len: usize, ctx: JSC.C.JSContextRef, exception: JSC.C.ExceptionRef) bool { switch (len) { - 0 => { - JSC.throwInvalidArguments("Invalid path string: can't be empty", .{}, ctx, exception); - return false; - }, - 1...bun.MAX_PATH_BYTES => return true, + 0...bun.MAX_PATH_BYTES => return true, else => { // TODO: should this be an EINVAL? JSC.throwInvalidArguments( |