v18.18.2 -> v18.19.0, v20.5.1 -> v20.6.0 regression: pathToFileURL trims whitespace. #51167
Labels
confirmed-bug
Issues with confirmed bugs.
url
Issues and PRs related to the legacy built-in url module.
whatwg-url
Issues and PRs related to the WHATWG URL implementation.
Version
v18.19.0, v20.6.0
Platform
Darwin Kernel Version 23.2.0: Wed Nov 15 21:53:18 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6000 arm64
Subsystem
url
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
always
What is the expected behavior? Why is that the expected behavior?
In Node v18.18.2 and v20.5.1:
What do you see instead?
Where prior versions retained the trailing whitespace and returned a pathname ending in
/test-%00
, starting in v18.19.0 and v20.6.0 the trailing whitespace is removed and results in a pathname ending in/test-
.Additional information
This regression was introduced by optimizations in #48709, specifically the switch from:
To:
While these seem equivalent,
new URL
usesparse
, which trims leading and trailing whitespace from the path. In contrast, the earlier method of settingpathname
directly does not trim whitespace.I'm not sure which way is actually preferred, but regardless this was an unexpected (and undocumented) breaking change.
The text was updated successfully, but these errors were encountered: