From d4dcab43e2e803f61b955c181e797bde6243e33c Mon Sep 17 00:00:00 2001 From: Sergey Chernyshev Date: Thu, 25 Apr 2024 04:20:40 +0200 Subject: [PATCH] src: add a condition if the argument of `DomainToUnicode` is PR-URL: https://github.com/nodejs/node/pull/49097 Refs: https://github.com/nodejs/node/pull/46410 Reviewed-By: Yagiz Nizipli Reviewed-By: Deokjin Kim --- graal-nodejs/src/node_url.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/graal-nodejs/src/node_url.cc b/graal-nodejs/src/node_url.cc index 30a1a6ec987..149a926841b 100644 --- a/graal-nodejs/src/node_url.cc +++ b/graal-nodejs/src/node_url.cc @@ -95,6 +95,11 @@ void BindingData::DomainToUnicode(const FunctionCallbackInfo& 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.