Skip to content

Windows file paths in URL parsing #873

@mertcanaltin

Description

@mertcanaltin

I've discovered an interesting behavior in the WHATWG URL specification: Windows file paths such as C:\path\file.node are considered valid URLs.

The issue

  • Security: Web apps might accidentally treat file paths as URLs
  • UX: Users expect C:\path\file to be a local file, not a URL
  • Consistency: Other OS paths aren't treated as URLs

Current vs Proposed

// Now
URL.canParse("C:\\path\\file.node") // true

//Should be
URL.canParse("C:\\path\\file.node") // false
URL.canParse("file:///C:/path/file.node") // true

Related Issues

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