use super::types::BlockType;
#[derive(Debug, Clone, Default, PartialEq)]
pub struct MinimalSanitizeConfig {
pub max_image_bytes: Option<u64>,
pub max_video_bytes: Option<u64>,
pub max_pdf_bytes: Option<u64>,
pub max_messages_turns: Option<u64>,
pub permanent_deny_blocks: Vec<BlockType>,
}
impl MinimalSanitizeConfig {
pub fn is_empty(&self) -> bool {
self.max_image_bytes.unwrap_or(0) == 0
&& self.max_video_bytes.unwrap_or(0) == 0
&& self.max_pdf_bytes.unwrap_or(0) == 0
&& self.max_messages_turns.unwrap_or(0) == 0
&& self.permanent_deny_blocks.is_empty()
}
}
#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
pub enum SanitizeError {
#[error("sanitize: messages history exceeds configured depth")]
HistoryTooDeep,
#[error("sanitize: block type permanently denied")]
BlockDenied,
#[error("sanitize: {block_type} base64 size {actual} exceeds limit {limit}")]
Size {
block_type: BlockType,
actual: u64,
limit: u64,
},
}