Skip to main content

decode_file_uri_paths

Function decode_file_uri_paths 

Source
pub fn decode_file_uri_paths(
    paths: &[PlRefPath],
    glob: bool,
) -> Cow<'_, [PlRefPath]>
Available on crate feature polars-io only.
Expand description

Decode % escapes in file:// paths and return them as plain local paths (e.g. file:///x/foo%3Dbar -> /x/foo=bar).

The file:// is dropped before decoding, so the result is a plain path, not a URI. That keeps decoded ?/# as literal filename characters; kept as a URI they’d be read as a query or fragment and cut the path short.

When glob is set, a percent-encoded path is treated as a literal: every glob metacharacter in the decoded result is escaped (? -> [?]), so a decoded ?/* matches the literal character instead of acting as a wildcard. A path with no % is never decoded (see below), so a plain file:///x/*.parquet still globs as usual.

Everything else is returned unchanged: file:// paths with no %, plain paths, and cloud keys (s3://, …), which are taken literally.