mirror of
https://github.com/lsd-rs/lsd
synced 2025-01-18 22:43:59 +00:00
Escape invalid unicode encoded names
This commit is contained in:
parent
526f020695
commit
268f7bf79f
2 changed files with 3 additions and 6 deletions
|
@ -16,8 +16,7 @@ impl Name {
|
|||
let mut name = path
|
||||
.file_name()
|
||||
.expect("failed to retrieve file name")
|
||||
.to_str()
|
||||
.expect("failed to encode file name")
|
||||
.to_string_lossy()
|
||||
.to_string();
|
||||
|
||||
if file_type == FileType::Directory {
|
||||
|
|
|
@ -14,15 +14,13 @@ impl<'a> From<&'a Metadata> for Owner {
|
|||
let user = get_user_by_uid(meta.uid())
|
||||
.expect("failed to get user name")
|
||||
.name()
|
||||
.to_str()
|
||||
.expect("failed to convert user name to str")
|
||||
.to_string_lossy()
|
||||
.to_string();
|
||||
|
||||
let group = get_group_by_gid(meta.gid())
|
||||
.expect("failed to get the group name")
|
||||
.name()
|
||||
.to_str()
|
||||
.expect("failed to convert group name to str")
|
||||
.to_string_lossy()
|
||||
.to_string();
|
||||
|
||||
Owner { user, group }
|
||||
|
|
Loading…
Reference in a new issue