jsdom / whatwg-url

An implementation of the WHATWG URL Standard in JavaScript
https://jsdom.github.io/whatwg-url/
MIT License
371 stars 94 forks source link

Invalid URL: mongodb://__this_is_a_placeholder__/mydb #221

Closed jyriandr closed 2 years ago

jyriandr commented 2 years ago

I'm getting an error when trying to connect to a local mongodb. It seems that the problem is in this line of code in whatwg-url https://github.com/jsdom/whatwg-url/blob/5f8ab9a06ffce2eacb75e949a43b23e573c42d6c/lib/url-state-machine.js#L523

this.input = Array.from(this.input, c => c.codePointAt(0));

For some reason, when mapping the input from characters to codes the c.codePointAt(0) is returning the initial character. That fails the check on line 527:

const cStr = isNaN(c) ? undefined : String.fromCodePoint(c);

domenic commented 2 years ago

Can you produce a small piece of code, that uses whatwg-url and nothing else, which we can run to debug? We'll close that issue until then as this is not enough detail to help with; please comment with that reproduction file and we can reopen.