Skip to content

Windows file URI parsing yields an invalid path with a leading slash #24099

@Sc3l3t0n

Description

@Sc3l3t0n

Zig Version

0.14.1

Steps to Reproduce and Observed Behavior

When trying to parse a Windows file path URI, the resulting value of the struct field path is not valid.

const path_uri = "file:///C:/Users/someone";
const uri = try std.Uri.parse(path_uri);

// uri.path.percent_encoded contains "/C:/Users/someone"
try std.testing.expectEqualStrings("/C:/Users/someone", uri.path.percent_encoded);

Expected Behavior

The parser should strip the leading slash when converting a Windows file URI. In this example, the path field should only contain "C:/Users/someone" (without the trailing /).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions