mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
url: handle unicode hostname if empty
PR-URL: https://github.com/nodejs/node/pull/49396 Fixes: https://github.com/nodejs/node/issues/48759 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
1 parent
67cb6f9a34
commit
f256b160bf
2 files changed
+6
-1
No files matched your search
+1
-1
@@ -168,7 +168,7 @@ void BindingData::Format(const FunctionCallbackInfo<Value>& args) {
|
||||
out->hash = std::nullopt;
|
||||
}
|
||||
|
||||
if (unicode) {
|
||||
if (unicode && out->has_hostname()) {
|
||||
out->host = ada::idna::to_unicode(out->get_hostname());
|
||||
}
|
||||
|
||||
|
||||
@@ -140,3 +140,8 @@ assert.strictEqual(
|
||||
url.format(new URL('http://user:pass@xn--0zwm56d.com:8080/path'), { unicode: true }),
|
||||
'http://user:pass@测试.com:8080/path'
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
url.format(new URL('tel:123')),
|
||||
url.format(new URL('tel:123'), { unicode: true })
|
||||
);
|
||||
Reference in new issue
Block a user