diff options
author | 2022-09-07 21:21:18 -0700 | |
---|---|---|
committer | 2022-09-07 21:21:18 -0700 | |
commit | 812424bf4606cee0554278ee759c939b8e7f216f (patch) | |
tree | ab06e4344eaedbfd67ba76480dae74d04bbf8652 | |
parent | 8af05c28a3dea66df24a7e818a7d5c9ecd4ddc5a (diff) | |
download | bun-812424bf4606cee0554278ee759c939b8e7f216f.tar.gz bun-812424bf4606cee0554278ee759c939b8e7f216f.tar.zst bun-812424bf4606cee0554278ee759c939b8e7f216f.zip |
Fix crash with file descriptor
-rw-r--r-- | src/bun.js/webcore/response.zig | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/bun.js/webcore/response.zig b/src/bun.js/webcore/response.zig index da5458505..e649bb923 100644 --- a/src/bun.js/webcore/response.zig +++ b/src/bun.js/webcore/response.zig @@ -867,11 +867,9 @@ const PathOrBlob = union(enum) { pub fn fromJS(ctx: js.JSContextRef, args: *JSC.Node.ArgumentsSlice, exception: js.ExceptionRef) ?PathOrBlob { if (JSC.Node.PathOrFileDescriptor.fromJS(ctx, args, exception)) |path| { - return PathOrBlob{ .path = .{ - .path = .{ - .string = bun.PathString.init((bun.default_allocator.dupeZ(u8, path.path.slice()) catch unreachable)[0..path.path.slice().len]), - }, - } }; + return PathOrBlob{ + .path = path, + }; } const arg = args.nextEat() orelse return null; @@ -887,11 +885,9 @@ const PathOrBlob = union(enum) { pub fn fromJSNoCopy(ctx: js.JSContextRef, args: *JSC.Node.ArgumentsSlice, exception: js.ExceptionRef) ?PathOrBlob { if (JSC.Node.PathOrFileDescriptor.fromJS(ctx, args, exception)) |path| { - return PathOrBlob{ .path = .{ - .path = .{ - .string = bun.PathString.init(path.path.slice()), - }, - } }; + return PathOrBlob{ + .path = path, + }; } const arg = args.nextEat() orelse return null; |