diff options
author | cjihrig <cjihrig@gmail.com> | 2019-02-20 20:47:25 -0500 |
---|---|---|
committer | cjihrig <cjihrig@gmail.com> | 2019-02-26 16:04:03 -0500 |
commit | 4900863043406528d7cd37e8233fe449fa76f9bf (patch) | |
tree | 2098899f0cc379ef6e1709d155c5b98f0baa3435 /lib/internal/url.js | |
parent | ccd6b12fec944c0e77fc60ffd8cea9781d850a2e (diff) | |
download | android-node-v8-4900863043406528d7cd37e8233fe449fa76f9bf.tar.gz android-node-v8-4900863043406528d7cd37e8233fe449fa76f9bf.tar.bz2 android-node-v8-4900863043406528d7cd37e8233fe449fa76f9bf.zip |
url: handle quasi-WHATWG URLs in urlToOptions()
PR-URL: https://github.com/nodejs/node/pull/26226
Refs: https://github.com/nodejs/node/issues/26198
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'lib/internal/url.js')
-rw-r--r-- | lib/internal/url.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/internal/url.js b/lib/internal/url.js index 6ad7122b86..81a4966288 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js @@ -1257,13 +1257,13 @@ function domainToUnicode(domain) { function urlToOptions(url) { var options = { protocol: url.protocol, - hostname: url.hostname.startsWith('[') ? + hostname: typeof url.hostname === 'string' && url.hostname.startsWith('[') ? url.hostname.slice(1, -1) : url.hostname, hash: url.hash, search: url.search, pathname: url.pathname, - path: `${url.pathname}${url.search}`, + path: `${url.pathname || ''}${url.search || ''}`, href: url.href }; if (url.port !== '') { |