Skip to main content

safe_open_under

Function safe_open_under 

pub async fn safe_open_under(
    root: impl AsRef<Path>,
    path: impl AsRef<Path>,
) -> Result<File, Error>
Available on crate feature std only.
Expand description

Open a file read-only, confined to root, given an absolute path.

safe_open_in treats its path as relative to root and rejects absolute ones; this accepts an absolute path (as a file: uri yields) and rejects it when it does not live under root.