feat: enhance safety filters for shell commands by normalizing ANSI-C quoting
This commit is contained in:
@@ -63,8 +63,12 @@ impl EditLog {
|
||||
/// any filesystem operation fails.
|
||||
pub fn append(&mut self, entry: EditLogEntry) -> std::io::Result<()> {
|
||||
let line = serde_json::to_string(&entry)? + "\n";
|
||||
let parent = self.path.parent().unwrap();
|
||||
std::fs::create_dir_all(parent)?;
|
||||
// Ensure parent directory exists; fall back to the current
|
||||
// directory if path has no parent (should not happen in practice
|
||||
// since EditLog::new always joins to a session dir).
|
||||
if let Some(parent) = self.path.parent() {
|
||||
std::fs::create_dir_all(parent)?;
|
||||
}
|
||||
let mut file = std::fs::OpenOptions::new()
|
||||
.create(true)
|
||||
.append(true)
|
||||
|
||||
Reference in New Issue
Block a user