File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -722,11 +722,13 @@ void napi_module_register_by_symbol(v8::Local<v8::Object> exports,
722
722
filename_js->IsString ()) {
723
723
node::Utf8Value filename (node_env->isolate (), filename_js);
724
724
725
- // Turn the absolute path into a URL. Currently the absolute path is always
726
- // a file system path.
727
- // TODO(gabrielschulhof): Pass the `filename` through unchanged if/when we
728
- // receive it as a URL already.
729
- module_filename = node::url::FromFilePath (filename.ToStringView ());
725
+ std::string_view filename_str (filename.out (), filename.length ());
726
+ if (filename_str.find (" ://" ) != std::string_view::npos) {
727
+ // Already a URL, use it directly
728
+ module_filename = filename_str;
729
+ } else {
730
+ module_filename = node::url::FromFilePath (filename.ToStringView ());
731
+ }
730
732
}
731
733
732
734
// Create a new napi_env for this specific module.
You can’t perform that action at this time.
0 commit comments