fix(fermata): an editor's swap or backup file no longer refuses

One non-UTF-8 .env.swp blocked everything a checkout sent across a link, and would
withhold every tool output under deny. A discovered *.swp, *.swo, *.swn, *.swx or
*~ that cannot be read or parsed is now passed over under every setting. One that
can be parsed stays known to the redactor. .bak, .env.gpg and [[file]] overrides
keep the rule.
This commit is contained in:
2026-11-06 23:36:57 +01:00
parent 969cff212f
commit 5c3b239f59
5 changed files with 84 additions and 0 deletions
+10
View File
@@ -225,6 +225,16 @@ fn other_settings_stay_open_and_quote_nothing() {
}
}
/// An editor's file does not take down every tool output of a `deny` project.
#[test]
fn an_editors_swap_file_does_not_withhold_under_deny() {
let p = project(&[(".botsecrets", DENY), (".env", "API_TOKEN=value-on-the-failing-line\n")]);
fs::write(p.dir.path().join(".env.swp"), b"b0VIM \xff\xfe\x00\x01").unwrap();
let (out, _) = p.post(json!(RESPONSE));
let text = out["hookSpecificOutput"]["updatedToolOutput"].as_str().unwrap();
assert!(text.starts_with("output of the tool") && !text.contains(VALUE), "{text}");
}
// ---------------------------------------------------------------------------
// PreToolUse
// ---------------------------------------------------------------------------