Skip to content

Consider Including Drive Letter in Uri.path [Windows] #160

Description

@StDymphna

While RFC 3986 does not specify how to handle drive letters, the majority of implementations include the drive letter (e.g. C:\ , D:, ...) on Windows, and so omitting it does not really match up with real-world behavior or applications. Newer RFCs/standards also use this behavior, e.g. RFC 8089 , WhatWG .

Without it, it is impossible to use solely Uri.path to return a path on the non-current drive.

Examples:

Printf.printf "%s \n" (Uri.pct_decode(Uri.path(Uri.of_string("C:\\Program Files (x86)\\"))))
Printf.printf "%s \n" (Uri.pct_decode(Uri.path(Uri.of_string("D:\\Program Files (x86)\\"))))

Both return:

\Program Files (x86)\

which only gives a path on the current drive, while, I feel, a more appropriate result would be:

C:\Program Files (x86)\
D:\Program Files (x86)\

Inconsistently, in these basic examples, using Uri.to_string (instead of Uri.path) will return with the drive letter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions