diff options
author | Marcos Casagrande <marcoscvp90@gmail.com> | 2020-04-28 16:40:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-28 10:40:17 -0400 |
commit | 927a771fa438ed9833a82fd87521bef50f4b4adc (patch) | |
tree | 9d418db110256dca4216073ced54b8278ce1bad4 /cli/js/web/url.ts | |
parent | 5a03e42117d537494ae7f331ab48bfb0ed40310f (diff) |
url: Make zero a valid port (#4963)
Diffstat (limited to 'cli/js/web/url.ts')
-rw-r--r-- | cli/js/web/url.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/cli/js/web/url.ts b/cli/js/web/url.ts index 77285e456..6a8dc6627 100644 --- a/cli/js/web/url.ts +++ b/cli/js/web/url.ts @@ -193,10 +193,10 @@ export class URLImpl implements URL { // https://url.spec.whatwg.org/#port-state if (value === "") return value; - const port = parseInt(value, 10); - - if (!Number.isNaN(port) && port > 0 && port <= MAX_PORT) + const port = Number(value); + if (Number.isInteger(port) && port >= 0 && port <= MAX_PORT) { return port.toString(); + } return undefined; }; |