Skip to main content

write_target

Function write_target 

Source
pub fn write_target(
    config: &SessionConfig,
    target: &str,
) -> Result<Option<String>>
Expand description

Where a write to target (COPY … TO 'target', .output target) goes in the session with config: Ok(None) to write it as named, in a session with no directory Root; in a session with one, the absolute path under the root that target names, or why it may not be written (a reason that does not repeat target, for the caller to say what was refused). A read-only session (set_read_only) refuses every target.

A rooted session writes only under its root. target must be a relative path with no .. (not absolute, not ~/…, not a URL), and no part of it that exists may be a symbolic link that leads outside the root. The check is made before the write, not during it: it keeps a client of the session (a page, an agent) inside the root, not another process that swaps a directory for a link in between.