Skip to content

Path with a dot folder does not return the normalized path #935

@SamVerschueren

Description

@SamVerschueren

Version

latest

Platform

Darwin Sams-MacBook-Pro.local 24.3.0 Darwin Kernel Version 24.3.0: Thu Jan 2 20:24:22 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6041 arm64

What steps will reproduce the bug?

In Node.js, when parsing a URL with a dotfolder, the result is different compared to not having a dotfolder in the path.

> new URL('file:///foo/.bar/../baz.js').toString()
'file:///foo/.bar/../baz.js'

> new URL('file:///foo/bar/../baz.js').toString()
'file:///foo/baz.js'

As you can see, both paths are identical but the first one has .bar in it while the second just has bar. The result of the call is not normalized.

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

No

What is the expected behavior?

Both paths should normalize correctly.

What do you see instead?

> new URL('file:///foo/.bar/../baz.js').toString()
'file:///foo/.bar/../baz.js'

> new URL('file:///foo/bar/../baz.js').toString()
'file:///foo/baz.js'

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions