From 1ff42ecf134726917f96211b4f7df405930b9649 Mon Sep 17 00:00:00 2001 From: ChristianVisintin Date: Sun, 29 Nov 2020 15:56:01 +0100 Subject: [PATCH] to_string_lossy().to_string() for users/groups --- src/fs/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/fs/mod.rs b/src/fs/mod.rs index 3c4c75f..4853335 100644 --- a/src/fs/mod.rs +++ b/src/fs/mod.rs @@ -151,7 +151,7 @@ impl std::fmt::Display for FsEntry { // Get username let username: String = match dir.user { Some(uid) => match get_user_by_uid(uid) { - Some(user) => user.name(), + Some(user) => user.name().to_string_lossy().to_string(), None => uid.to_string(), }, None => String::from("0"), @@ -159,7 +159,7 @@ impl std::fmt::Display for FsEntry { // Get group let group: String = match dir.group { Some(gid) => match get_group_by_gid(gid) { - Some(group) => group.name(), + Some(group) => group.name().to_string_lossy().to_string(), None => gid.to_string(), }, None => String::from("0"), @@ -240,7 +240,7 @@ impl std::fmt::Display for FsEntry { // Get username let username: String = match file.user { Some(uid) => match get_user_by_uid(uid) { - Some(user) => user.name(), + Some(user) => user.name().to_string_lossy().to_string(), None => uid.to_string(), }, None => String::from("0"), @@ -248,7 +248,7 @@ impl std::fmt::Display for FsEntry { // Get group let group: String = match file.group { Some(gid) => match get_group_by_gid(gid) { - Some(group) => group.name(), + Some(group) => group.name().to_string_lossy().to_string(), None => gid.to_string(), }, None => String::from("0"),