Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.3k
Closed
Closed
Copy link
Description
Version
22.5.1
Platform
Linux earlyriser-virtual-machine 6.5.0-44-generic #44~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Jun 18 14:36:16 UTC 2 x86_64 x86_64 x86_64 GNU/Linux Subsystem
No response
What steps will reproduce the bug?
$ node Welcome to Node.js v22.5.1. Type ".help" for more information. > require('url').pathToFileURL('\\server\foobar[',{windows: true }).href; 'file:///C:/server%0Coobar[' > require('url').pathToFileURL('\\server\foobar[',{windows: false }).href; 'file:///Users/admin/%5Cserver%0Coobar[' > require('url').pathToFileURL('C:/path^',{windows: true }).href; 'file:///C:/path^' > require('url').pathToFileURL('home/path^',{windows: false }).href; 'file:///Users/admin/home/path^' How often does it reproduce? Is there a required condition?
everytime
What is the expected behavior? Why is that the expected behavior?
I think the expected behavior is:
> require('url').pathToFileURL('\\server\foobar[',{windows: true }).href; 'file:///C:/server%0Coobar%5E' > require('url').pathToFileURL('\\server\foobar[',{windows: false }).href; 'file:///Users/admin/%5Cserver%0Coobar%5B' > require('url').pathToFileURL('C:/path^',{windows: true }).href; 'file:///C:/path%5E' > require('url').pathToFileURL('home/path^',{windows: false }).href; 'file:///Users/admin/home/path%5D' because [ and ] are special characters used to specify IP addresses in URLs, and ^ is generally unsafe in URLs and should also be percent-encoded.
What do you see instead?
I see that [, ], and ^ are not encoded
Additional information
I think that setter and constructor both didn't encoded those special characters
Metadata
Metadata
Assignees
Labels
No labels