Skip to content

Commit

Permalink
src: add a condition if the argument of DomainToUnicode is empty
Browse files Browse the repository at this point in the history
PR-URL: #49097
Refs: #46410
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Deokjin Kim <deokjin81.kim@gmail.com>
  • Loading branch information
Jungku Lee authored and UlisesGascon committed Sep 10, 2023
1 parent a6cfea3 commit 4a9ae31
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/node_url.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,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 4a9ae31

Please sign in to comment.