Skip to main content

load_bytes_from_location

Function load_bytes_from_location 

Source
pub async fn load_bytes_from_location(
    client: &Client,
    location: &str,
    working_dir: &Path,
    extra_allowed_dirs: &[PathBuf],
) -> Result<(Vec<u8>, Option<String>), String>
Expand description

Resolve a “location” (absolute URL, file path, or data: URI) into bytes + optional mime-type. Applies SSRF check when fetching over HTTP.

File-path resolution is bounded to working_dir plus any explicit directories in extra_allowed_dirs. Absolute paths outside both sets are rejected.