diff --git a/src/bun.js/node/types.zig b/src/bun.js/node/types.zig index 4bf3441ff8..c94293e46f 100644 --- a/src/bun.js/node/types.zig +++ b/src/bun.js/node/types.zig @@ -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 { diff --git a/test/js/node/path/to-namespaced-path.test.js b/test/js/node/path/to-namespaced-path.test.js index 315a726382..1e6edd4067 100644 --- a/test/js/node/path/to-namespaced-path.test.js +++ b/test/js/node/path/to-namespaced-path.test.js @@ -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);