diff options
author | Yoshiya Hinosawa <stibium121@gmail.com> | 2023-05-17 14:51:51 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-17 14:51:51 +0900 |
commit | 243d9c846df5fd9011937655f229b7068b001e3e (patch) | |
tree | 5705ef4ee871dd43412bd42932429ff7f6bf77cd /ext/node | |
parent | f59b1d8a300db8c4ca6b96daee8ec9ac3ad8f969 (diff) |
fix(ext/node): fix whatwg url formatting (#19146)
Diffstat (limited to 'ext/node')
-rw-r--r-- | ext/node/polyfills/url.ts | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/ext/node/polyfills/url.ts b/ext/node/polyfills/url.ts index 4beebe844..28b6060bc 100644 --- a/ext/node/polyfills/url.ts +++ b/ext/node/polyfills/url.ts @@ -939,14 +939,11 @@ export function format( ["Object", "string"], urlObject, ); - } else if (!(urlObject instanceof Url)) { - if (urlObject instanceof URL) { - return formatWhatwg(urlObject, options); - } - return Url.prototype.format.call(urlObject); + } else if (urlObject instanceof URL) { + return formatWhatwg(urlObject, options); } - return (urlObject as Url).format(); + return Url.prototype.format.call(urlObject); } /** @@ -1002,10 +999,9 @@ function formatWhatwg( } ret += "@"; } - // TODO(wafuwfu13): Support unicode option - // ret += options.unicode ? - // domainToUnicode(urlObject.host) : urlObject.host; - ret += urlObject.host; + ret += options.unicode + ? domainToUnicode(urlObject.hostname) + : urlObject.hostname; if (urlObject.port) { ret += `:${urlObject.port}`; } |