pub struct ReassembledFile {
pub filename: String,
pub mode: u32,
pub data: Vec<u8>,
pub is_truncated: bool,
pub missing_parts: Vec<u32>,
}Expand description
A successfully reassembled multi-part UU-encoded file.
Returned by reassemble. The data field holds the decoded binary
payload; callers should inspect is_truncated before trusting the result.
§Security note
data may contain a compressed archive. This crate never decompresses
the output. Apply independent size and resource limits before
decompressing to protect against decompression-bomb attacks.
Fields§
§filename: StringFilename extracted from the begin line of the first UU part.
Security — path traversal: the filename comes directly from the
email or Usenet message and is not sanitised. Real-world UU archives
have been observed with filenames containing ../ sequences. Sanitise
this value before using it as a filesystem path to prevent directory
traversal attacks (e.g. reject names containing /, \, or ..
components, and resolve the final path against an allowed base
directory).
mode: u32Unix permission mode (e.g. 0o644) from the begin line of the first
part. Subsequent parts may specify different modes; only the first
part’s value is used.
data: Vec<u8>Decoded binary payload.
When is_truncated is false, this is the
complete decoded file content, formed by concatenating the decoded
output of every part in ascending part_number order.
§When is_truncated is true
data contains only the decoded bytes of the parts that were
present, concatenated in ascending part-number order. This is not
a contiguous region of the reconstructed file: the bytes belonging to
the absent parts are simply missing from the middle (or start, or end).
The resulting byte sequence does not correspond to any valid file
offset range.
Do not write truncated data to disk as if it were a complete file.
The bytes are provided for diagnostic inspection only (e.g. logging,
partial-content display). To obtain a usable file, wait until
is_complete() returns true
before calling reassemble.
is_truncated: booltrue when one or more parts were absent from the collection, or when
any individual part’s UU body was missing its end line. The data is
likely corrupt in this case.
To distinguish the two truncation causes:
is_truncated && !missing_parts.is_empty()— gap in the collection.is_truncated && missing_parts.is_empty()— all parts were present but at least one part’s UU body was itself truncated (missingend).
missing_parts: Vec<u32>Part numbers in 1..=total that were absent from the collection, in
ascending order. Empty when the collection was complete.
Trait Implementations§
Source§impl Debug for ReassembledFile
impl Debug for ReassembledFile
Source§impl PartialEq for ReassembledFile
impl PartialEq for ReassembledFile
Source§fn eq(&self, other: &ReassembledFile) -> bool
fn eq(&self, other: &ReassembledFile) -> bool
self and other values to be equal, and is used by ==.