Skip to content

Commit 9252edd

Browse files
committed
fix db raw content
1 parent b5b83a9 commit 9252edd

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/models.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ impl User {
7373
users.push(Self {
7474
avatar,
7575
id: res.id,
76-
name: res.name,
77-
pid: PeerId::from_hex(res.pid).unwrap_or(PeerId::default()),
76+
name: res.name.trim().to_owned(),
77+
pid: PeerId::from_hex(res.pid.trim()).unwrap_or(PeerId::default()),
7878
bio: res.bio,
7979
is_actived: res.is_actived,
8080
datetime: res.datetime,
@@ -95,8 +95,8 @@ impl User {
9595
Ok(Self {
9696
avatar,
9797
id: res.id,
98-
name: res.name,
99-
pid: PeerId::from_hex(res.pid).unwrap_or(PeerId::default()),
98+
name: res.name.trim().to_owned(),
99+
pid: PeerId::from_hex(res.pid.trim()).unwrap_or(PeerId::default()),
100100
bio: res.bio,
101101
is_actived: res.is_actived,
102102
datetime: res.datetime,
@@ -114,8 +114,8 @@ impl User {
114114
Ok(Self {
115115
avatar,
116116
id: res.id,
117-
name: res.name,
118-
pid: PeerId::from_hex(res.pid).unwrap_or(PeerId::default()),
117+
name: res.name.trim().to_owned(),
118+
pid: PeerId::from_hex(res.pid.trim()).unwrap_or(PeerId::default()),
119119
bio: res.bio,
120120
is_actived: res.is_actived,
121121
datetime: res.datetime,
@@ -133,8 +133,8 @@ impl User {
133133
Ok(Self {
134134
avatar,
135135
id: res.id,
136-
name: res.name,
137-
pid: PeerId::from_hex(res.pid).unwrap_or(PeerId::default()),
136+
name: res.name.trim().to_owned(),
137+
pid: PeerId::from_hex(res.pid.trim()).unwrap_or(PeerId::default()),
138138
bio: res.bio,
139139
is_actived: res.is_actived,
140140
datetime: res.datetime,

0 commit comments

Comments
 (0)