diff options
author | noyez <noyez@ithryn.net> | 2022-06-05 16:35:46 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-05 21:35:46 +0100 |
commit | 3c2b055039f49e24fcbf957a60eeb3ea210bf6b4 (patch) | |
tree | b8e4d43b2451e7153af15318b339713d977d8289 | |
parent | 3f5350dee6412a5cf225c3f44b9d5c53cb4c731d (diff) |
Noyez fix dir hostname utf8 (#430)
* Allow zsh_histdb import diretories and hostnames as utf-8
* Allow zsh_histdb import diretories and hostnames as utf-8
Co-authored-by: Bradley Noyes <b@noyes.dev>
-rw-r--r-- | atuin-client/src/import/zsh_histdb.rs | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/atuin-client/src/import/zsh_histdb.rs b/atuin-client/src/import/zsh_histdb.rs index 34718f89..16de2a7f 100644 --- a/atuin-client/src/import/zsh_histdb.rs +++ b/atuin-client/src/import/zsh_histdb.rs @@ -53,8 +53,8 @@ pub struct HistDbEntryCount { pub struct HistDbEntry { pub id: i64, pub start_time: NaiveDateTime, - pub host: String, - pub dir: String, + pub host: Vec<u8>, + pub dir: Vec<u8>, pub argv: Vec<u8>, pub duration: i64, } @@ -67,11 +67,19 @@ impl From<HistDbEntry> for History { .unwrap_or_else(|_e| String::from("")) .trim_end() .to_string(), - histdb_item.dir, + String::from_utf8(histdb_item.dir) + .unwrap_or_else(|_e| String::from("")) + .trim_end() + .to_string(), 0, // assume 0, we have no way of knowing :( histdb_item.duration, None, - Some(histdb_item.host), + Some( + String::from_utf8(histdb_item.host) + .unwrap_or_else(|_e| String::from("")) + .trim_end() + .to_string(), + ), ) } } |