summaryrefslogtreecommitdiff
path: root/ext/node/lib.rs
diff options
context:
space:
mode:
authorYoshiya Hinosawa <stibium121@gmail.com>2022-11-29 14:13:14 +0900
committerGitHub <noreply@github.com>2022-11-29 14:13:14 +0900
commite4fe5ee72ace30ccd1b7b6b15717164cf79f49c4 (patch)
tree833984b1e239fc82ad840bd5c43b7cb2b6f84751 /ext/node/lib.rs
parentd3299c2d6c036d3f016ef1abbe9c06e9b1656fd0 (diff)
fix(ext/node): allow absolute path in createRequire (#16853)
Co-authored-by: David Sherret <dsherret@gmail.com>
Diffstat (limited to 'ext/node/lib.rs')
-rw-r--r--ext/node/lib.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/node/lib.rs b/ext/node/lib.rs
index 0e84cea7b..c365d5d7b 100644
--- a/ext/node/lib.rs
+++ b/ext/node/lib.rs
@@ -245,7 +245,10 @@ where
fn op_require_proxy_path(filename: String) -> String {
// Allow a directory to be passed as the filename
let trailing_slash = if cfg!(windows) {
- filename.ends_with('\\')
+ // Node also counts a trailing forward slash as a
+ // directory for node on Windows, but not backslashes
+ // on non-Windows platforms
+ filename.ends_with('\\') || filename.ends_with('/')
} else {
filename.ends_with('/')
};