Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib: move ToNamespacedPath call to c++ #53654

Merged
merged 1 commit into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions lib/internal/modules/esm/formats.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const {

const { getOptionValue } = require('internal/options');
const { getValidatedPath } = require('internal/fs/utils');
const pathModule = require('path');
const fsBindings = internalBinding('fs');
const { fs: fsConstants } = internalBinding('constants');

Expand Down Expand Up @@ -48,9 +47,7 @@ function mimeToFormat(mime) {
*/
function getFormatOfExtensionlessFile(url) {
if (!experimentalWasmModules) { return 'module'; }

const path = pathModule.toNamespacedPath(getValidatedPath(url));

const path = getValidatedPath(url);
switch (fsBindings.getFormatOfExtensionlessFile(path)) {
case fsConstants.EXTENSIONLESS_FORMAT_WASM:
return 'wasm';
Expand Down
4 changes: 2 additions & 2 deletions src/node_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2966,8 +2966,8 @@ static void GetFormatOfExtensionlessFile(
CHECK(args[0]->IsString());

Environment* env = Environment::GetCurrent(args);
node::Utf8Value input(args.GetIsolate(), args[0]);

BufferValue input(args.GetIsolate(), args[0]);
ToNamespacedPath(env, &input);
THROW_IF_INSUFFICIENT_PERMISSIONS(
env, permission::PermissionScope::kFileSystemRead, input.ToStringView());

Expand Down
Loading