Sitelet https://github.com/nodejs/node/issues/46861
Skip to content

wrong result after setting port to a string that doesn't parse as a number #46861

Description

@meixg

Version

v20.0.0-pre

Platform

Linux meixg-desktop 5.11.0-43-generic #47~20.04.2-Ubuntu SMP Mon Dec 13 11:06:56 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

let u = new URL('http://example.net:8080/path')
u.port = 'randomstring'

How often does it reproduce? Is there a required condition?

always

What is the expected behavior?

{
    "href": "http://example.net:8080/path",
    "host": "example.net:8080",
    "hostname": "example.net",
    "port": "8080"
}

What do you see instead?

{
  href: 'http://example.net/path',
  host: 'example.net',
  hostname: 'example.net',
  port: ''
}

Additional information

https://github.com/web-platform-tests/wpt/blob/master/url/resources/setters_tests.json#L1596

#46860

Activity

  1. added
    whatwg-urlIssues and PRs related to the WHATWG URL implementation.
    on Feb 27, 2023
  2. meixg commented on Feb 27, 2023

    @meixg
    MemberAuthor

    My bad, rebuild and works fine now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    whatwg-urlIssues and PRs related to the WHATWG URL implementation.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions