fix: initialize magic cookie with mime type and encoding flags

Co-authored-by: aider (openai/andrew/openrouter/qwen/qwen3-coder) <aider@aider.chat>
This commit is contained in:
Andrew Phillips
2025-08-18 08:44:21 -03:00
parent 8de8368df7
commit ffd5fb12cc

View File

@@ -104,8 +104,8 @@ impl MetaPlugin for MagicFileMetaPlugin {
// Store raw pointer to connection - unsafe but necessary for this design // Store raw pointer to connection - unsafe but necessary for this design
self.conn = Some(conn as *const _ as *mut Connection); self.conn = Some(conn as *const _ as *mut Connection);
// Initialize magic cookie // Initialize magic cookie with flags for comprehensive detection
let cookie = Cookie::open(CookieFlags::empty()) let cookie = Cookie::open(CookieFlags::MIME_TYPE | CookieFlags::MIME_ENCODING)
.map_err(|e| anyhow::anyhow!("Failed to open magic cookie: {}", e))?; .map_err(|e| anyhow::anyhow!("Failed to open magic cookie: {}", e))?;
cookie.load(&[] as &[&str]) cookie.load(&[] as &[&str])
.map_err(|e| anyhow::anyhow!("Failed to load magic database: {}", e))?; .map_err(|e| anyhow::anyhow!("Failed to load magic database: {}", e))?;