diff options
| author | Lucas Trzesniewski <lucas.trzesniewski@gmail.com> | 2025-03-09 23:20:01 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-09 22:20:01 +0000 |
| commit | a24e7571e9cacc8ca46d04df6811288d926a99b9 (patch) | |
| tree | 128ea7c20763c794901d978f14b56447e113c619 /crates | |
| parent | feat(health): add health check endpoint at `/healthz` (#2549) (diff) | |
| download | atuin-a24e7571e9cacc8ca46d04df6811288d926a99b9.zip | |
fix: don't save empty commands (#2605)
Diffstat (limited to 'crates')
| -rw-r--r-- | crates/atuin-client/src/history.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/crates/atuin-client/src/history.rs b/crates/atuin-client/src/history.rs index 48d48eb7..6469740e 100644 --- a/crates/atuin-client/src/history.rs +++ b/crates/atuin-client/src/history.rs @@ -375,6 +375,7 @@ impl History { pub fn should_save(&self, settings: &Settings) -> bool { !(self.command.starts_with(' ') + || self.command.is_empty() || settings.history_filter.is_match(&self.command) || settings.cwd_filter.is_match(&self.cwd) || (settings.secrets_filter && SECRET_PATTERNS_RE.is_match(&self.command))) @@ -413,6 +414,13 @@ mod tests { .build() .into(); + let empty: History = History::capture() + .timestamp(time::OffsetDateTime::now_utc()) + .command("") + .cwd("/") + .build() + .into(); + let stripe_key: History = History::capture() .timestamp(time::OffsetDateTime::now_utc()) .command("curl foo.com/bar?key=sk_test_1234567890abcdefghijklmnop") @@ -436,6 +444,7 @@ mod tests { assert!(normal_command.should_save(&settings)); assert!(!with_space.should_save(&settings)); + assert!(!empty.should_save(&settings)); assert!(!stripe_key.should_save(&settings)); assert!(!secret_dir.should_save(&settings)); assert!(!with_psql.should_save(&settings)); |
