nodejs / node

Node.js JavaScript runtime ✨🐢🚀✨
https://nodejs.org
Other
107.52k stars 29.56k forks source link

Regression in path.resolve #55612

Closed adnanel closed 2 hours ago

adnanel commented 2 hours ago

Version

23.0.0

Platform

Darwin REDACTED 23.6.0 Darwin Kernel Version 23.6.0: Thu Sep 12 23:34:49 PDT 2024; root:xnu-10063.141.1.701.1~1/RELEASE_X86_64 x86_64

Subsystem

No response

What steps will reproduce the bug?

const path = require("path/posix"); console.log(path.resolve("/Users/"));

How often does it reproduce? Is there a required condition?

always

What is the expected behavior? Why is that the expected behavior?

/Users

In the documentation the following is stated:

The resulting path is normalized and trailing slashes are removed unless the path is resolved to the root directory.

What do you see instead?

/Users/

Additional information

In node 22 the trailing backslash was trimmed, starting with node 23 this is no longer the case. This breaks a lot of code.

adnanel commented 2 hours ago

This seems to have been fixed in 23.1.0, so I assume it was already identified and fixed.