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 <[email protected]>
Reviewed-By: Deokjin Kim <[email protected]>
  • Loading branch information
Jungku Lee authored and targos committed Nov 26, 2023
1 parent 9e1c531 commit 8c33731
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 @@ -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 8c33731

Please sign in to comment.