Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(node:path): toNamespacedPath bugfix #11406

Merged
merged 1 commit into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/bun.js/node/types.zig
Original file line number Diff line number Diff line change
Expand Up @@ -4766,7 +4766,7 @@ pub const Path = struct {
buf[3] = CHAR_BACKWARD_SLASH;
return MaybeSlice(T){ .result = buf[0..bufSize] };
}
return MaybeSlice(T){ .result = path };
return MaybeSlice(T){ .result = resolvedPath };
}

pub inline fn toNamespacedPathWindowsJS_T(comptime T: type, globalObject: *JSC.JSGlobalObject, path: []const T, buf: []T, buf2: []T) JSC.JSValue {
Expand Down
4 changes: 3 additions & 1 deletion test/js/node/path/to-namespaced-path.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ describe("path.toNamespacedPath", () => {
assert.strictEqual(path.win32.toNamespacedPath("C:/foo"), "\\\\?\\C:\\foo");
assert.strictEqual(path.win32.toNamespacedPath("\\\\foo\\bar"), "\\\\?\\UNC\\foo\\bar\\");
assert.strictEqual(path.win32.toNamespacedPath("//foo//bar"), "\\\\?\\UNC\\foo\\bar\\");
assert.strictEqual(path.win32.toNamespacedPath("\\\\?\\foo"), "\\\\?\\foo");
assert.strictEqual(path.win32.toNamespacedPath("\\\\?\\foo\\"), "\\\\?\\foo\\");
assert.strictEqual(path.win32.toNamespacedPath("\\\\?\\foo"), "\\\\?\\foo\\");
assert.strictEqual(path.win32.toNamespacedPath("\\\\?\\c:\\Windows/System"), "\\\\?\\c:\\Windows\\System");
assert.strictEqual(path.win32.toNamespacedPath(null), null);
assert.strictEqual(path.win32.toNamespacedPath(true), true);
assert.strictEqual(path.win32.toNamespacedPath(1), 1);
Expand Down
Loading