diff options
| author | Ellie Huxtable <ellie@elliehuxtable.com> | 2023-08-07 11:18:39 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-07 11:18:39 +0100 |
| commit | 0d5332a87facabb7227458586002226fafa11acb (patch) | |
| tree | 719adf05cb0c5ae999e4e2fee00436c0376053ae /atuin-client/src/kv.rs | |
| parent | fix(docs): Correct command overview paths (#1145) (diff) | |
| download | atuin-0d5332a87facabb7227458586002226fafa11acb.zip | |
Prepare release v16.0.0 (#1143)
* Prepare release v16.0.0
* Remove debug output
* Fix kv dupes if the store already exists
* Add limit in frontend as well as sync backend
Diffstat (limited to 'atuin-client/src/kv.rs')
| -rw-r--r-- | atuin-client/src/kv.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/atuin-client/src/kv.rs b/atuin-client/src/kv.rs index 30018d63..ad53a3d1 100644 --- a/atuin-client/src/kv.rs +++ b/atuin-client/src/kv.rs @@ -7,6 +7,7 @@ use crate::settings::Settings; const KV_VERSION: &str = "v0"; const KV_TAG: &str = "kv"; +const KV_VAL_MAX_LEN: usize = 100 * 1024; #[derive(Debug, Clone, PartialEq, Eq)] pub struct KvRecord { @@ -91,6 +92,13 @@ impl KvStore { key: &str, value: &str, ) -> Result<()> { + if value.len() > KV_VAL_MAX_LEN { + return Err(eyre!( + "kv value too large: max len {} bytes", + KV_VAL_MAX_LEN + )); + } + let host_id = Settings::host_id().expect("failed to get host_id"); let record = KvRecord { |
