Skip to content

Commit

Permalink
src: add a condition if the argument of DomainToUnicode is
Browse files Browse the repository at this point in the history
PR-URL: nodejs/node#49097
Refs: nodejs/node#46410
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Deokjin Kim <deokjin81.kim@gmail.com>
  • Loading branch information
sercher committed Apr 25, 2024
1 parent aee579f commit ff49d15
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions graal-nodejs/src/node_url.cc
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ void BindingData::DomainToUnicode(const FunctionCallbackInfo<Value>& args) {
CHECK(args[0]->IsString());

std::string input = Utf8Value(env->isolate(), args[0]).ToString();
if (input.empty()) {
return args.GetReturnValue().Set(
String::NewFromUtf8(env->isolate(), "").ToLocalChecked());
}

// It is important to have an initial value that contains a special scheme.
// Since it will change the implementation of `set_hostname` according to URL
// spec.
Expand Down

0 comments on commit ff49d15

Please sign in to comment.