GeezerVison is showing github.com — lib: move `ToNamespacedPath` call to c++ · nodejs/node@cbe77b3
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: lib/internal/modules/esm/formats.js +1-4Lines changed: 1 addition & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
6 | 6 |
|
7 | 7 | const { getOptionValue } = require('internal/options'); |
8 | 8 | const { getValidatedPath } = require('internal/fs/utils'); |
9 | | -const pathModule = require('path'); |
10 | 9 | const fsBindings = internalBinding('fs'); |
11 | 10 | const { fs: fsConstants } = internalBinding('constants'); |
12 | 11 |
|
@@ -48,9 +47,7 @@ function mimeToFormat(mime) { |
48 | 47 | */ |
49 | 48 | function getFormatOfExtensionlessFile(url) { |
50 | 49 | if (!experimentalWasmModules) { return 'module'; } |
51 | | - |
52 | | - const path = pathModule.toNamespacedPath(getValidatedPath(url)); |
53 | | - |
| 50 | + const path = getValidatedPath(url); |
54 | 51 | switch (fsBindings.getFormatOfExtensionlessFile(path)) { |
55 | 52 | case fsConstants.EXTENSIONLESS_FORMAT_WASM: |
56 | 53 | return 'wasm'; |
|
Collapse file
Copy file name to clipboardExpand all lines: src/node_file.cc +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -2966,8 +2966,8 @@ static void GetFormatOfExtensionlessFile( |
2966 | 2966 | CHECK(args[0]->IsString()); |
2967 | 2967 |
|
2968 | 2968 | Environment* env = Environment::GetCurrent(args); |
2969 | | - node::Utf8Value input(args.GetIsolate(), args[0]); |
2970 | | - |
| 2969 | + BufferValue input(args.GetIsolate(), args[0]); |
| 2970 | + ToNamespacedPath(env, &input); |
2971 | 2971 | THROW_IF_INSUFFICIENT_PERMISSIONS( |
2972 | 2972 | env, permission::PermissionScope::kFileSystemRead, input.ToStringView()); |
2973 | 2973 |
|
|