Skip to content

url.domainToASCII cannot handle invalid domains #31133

@davidebombelli

Description

@davidebombelli

Summary

url.domainToASCII should print an empty string when an invalid domain is passed.

Version

deno 2.5.4 (stable, release, x86_64-unknown-linux-gnu)

v8 14.0.365.5-rusty

typescript 5.9.2

OS

Linux Mint 22 Wilma

Steps to reproduce

  1. Create file test.mjs with the following content:
import url from 'node:url';

console.log(url.domainToASCII('xn--iñvalid.com'));
  1. Run file deno test.mjs.

Expected Behaviour

An empty string should be output.

Actual Behaviour

error: Uncaught (in promise) Error: Errors
    at domainToASCII (ext:deno_node/internal/idna.ts:95:10)
    at Object.domainToASCII (node:url:1136:10)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions