diff options
-rw-r--r-- | atuin-client/src/import/bash.rs | 2 | ||||
-rw-r--r-- | atuin-server/src/handlers/history.rs | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/atuin-client/src/import/bash.rs b/atuin-client/src/import/bash.rs index df959cf1..9901c1f3 100644 --- a/atuin-client/src/import/bash.rs +++ b/atuin-client/src/import/bash.rs @@ -62,7 +62,7 @@ impl Importer for Bash { // this increment is deliberately very small to prevent particularly fast fingers // causing ordering issues; it also helps in handling the "here document" syntax, // where several lines are recorded in succession without individual timestamps - let timestamp_increment = Duration::nanoseconds(1); + let timestamp_increment = Duration::milliseconds(1); // make sure there is a minimum amount of time before the first known timestamp // to fit all commands, given the default increment diff --git a/atuin-server/src/handlers/history.rs b/atuin-server/src/handlers/history.rs index 9a7cb245..3e84074c 100644 --- a/atuin-server/src/handlers/history.rs +++ b/atuin-server/src/handlers/history.rs @@ -53,6 +53,14 @@ pub async fn list<DB: Database>( ) .await; + if req.sync_ts.timestamp_nanos() < 0 || req.history_ts.timestamp_nanos() < 0 { + error!("client asked for history from < epoch 0"); + return Err( + ErrorResponse::reply("asked for history from before epoch 0") + .with_status(StatusCode::BAD_REQUEST), + ); + } + if let Err(e) = history { error!("failed to load history: {}", e); return Err(ErrorResponse::reply("failed to load history") |