Skip to content

Commit

Permalink
Noyez fix dir hostname utf8 (atuinsh#430)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
noyez and noyez authored Jun 5, 2022
1 parent 3f5350d commit 3c2b055
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions atuin-client/src/import/zsh_histdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand All @@ -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(),
),
)
}
}
Expand Down

0 comments on commit 3c2b055

Please sign in to comment.