Skip to main content

export_document

Function export_document 

Source
pub fn export_document(
    doc: &CsafDocument,
    settings: &Settings,
) -> Result<PathBuf>
Expand description

Export a single CSAF document to the export directory.

The document’s csaf_version is rewritten to match the active settings.csaf_mode before writing, so switching the mode and re-exporting yields files in the selected version.

The document is re-validated after the version override; exports with hard validation errors are refused.

Creates the directory structure: {export_dir}/{year}/{seq}/ and writes the JSON file plus sidecar hash files.

§Errors

Returns an error if the tracking ID format is invalid, validation fails, or file writing fails.