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>
This commit is contained in:
parent
3f5350dee6
commit
3c2b055039
1 changed files with 12 additions and 4 deletions
|
@ -53,8 +53,8 @@ pub struct HistDbEntryCount {
|
||||||
pub struct HistDbEntry {
|
pub struct HistDbEntry {
|
||||||
pub id: i64,
|
pub id: i64,
|
||||||
pub start_time: NaiveDateTime,
|
pub start_time: NaiveDateTime,
|
||||||
pub host: String,
|
pub host: Vec<u8>,
|
||||||
pub dir: String,
|
pub dir: Vec<u8>,
|
||||||
pub argv: Vec<u8>,
|
pub argv: Vec<u8>,
|
||||||
pub duration: i64,
|
pub duration: i64,
|
||||||
}
|
}
|
||||||
|
@ -67,11 +67,19 @@ impl From<HistDbEntry> for History {
|
||||||
.unwrap_or_else(|_e| String::from(""))
|
.unwrap_or_else(|_e| String::from(""))
|
||||||
.trim_end()
|
.trim_end()
|
||||||
.to_string(),
|
.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 :(
|
0, // assume 0, we have no way of knowing :(
|
||||||
histdb_item.duration,
|
histdb_item.duration,
|
||||||
None,
|
None,
|
||||||
Some(histdb_item.host),
|
Some(
|
||||||
|
String::from_utf8(histdb_item.host)
|
||||||
|
.unwrap_or_else(|_e| String::from(""))
|
||||||
|
.trim_end()
|
||||||
|
.to_string(),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue