Skip to content

url.parse regression in 18.17+ #49330

Closed
Closed
@Cherry

Description

@Cherry

Version

v18.17.1

Platform

Microsoft Windows NT 10.0.19045.0 x64

Subsystem

No response

What steps will reproduce the bug?

18.17.1

url.parse("npm:postman-request@2.88.1-postman.33")
Uncaught TypeError [ERR_INVALID_URL]: Invalid URL
    at __node_internal_captureLargerStackTrace (node:internal/errors:496:5)
    at new NodeError (node:internal/errors:405:5)
    at Url.parse (node:url:445:17)
    at Object.urlParse [as parse] (node:url:167:13) {
  input: 'npm:postman-request@2.88.1-postman.33',
  code: 'ERR_INVALID_URL'
}

18.16.0

url.parse("npm:postman-request@2.88.1-postman.33")
Url {
  protocol: 'npm:',
  slashes: null,
  auth: 'postman-request',
  host: '2.88.1-postman.33',
  port: null,
  hostname: '2.88.1-postman.33',
  hash: null,
  search: null,
  query: null,
  pathname: null,
  path: null,
  href: 'npm:postman-request@2.88.1-postman.33'
}

What do you see instead?

18.17.1 throws a ERR_INVALID_URL TypeError instead of returning the URL object as per 18.16.0 and prior.

Additional information

This string seems to parse fine using new URL('npm:postman-request@2.88.1-postman.33') in both 18.16.0 and 18.17.1.

In 18.17:

PARSES: npm:postman-request@2.88.1
PARSES: npm:postman-request@2.88.1-postman
PARSES: npm:postman-request@2.88.1-postman.
FAILS: npm:postman-request@2.88.1-postman.33
PARSES: schema:something@1.0.0
PARSES: schema:something@1.0.0-p
FAILS: schema:something@1.0.0-p.1

In 18.16, all parse fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateIssues and PRs that are duplicates of other issues or PRs.urlIssues and PRs related to the legacy built-in url module.v18.xIssues that can be reproduced on v18.x or PRs targeting the v18.x-staging branch.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions