Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ssrlive committed Mar 12, 2024
1 parent 114f117 commit be80732
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,21 @@ impl TunnelPath {
}

pub fn standardize(&mut self) {
if self.is_empty() {
*self = TunnelPath::default();
}
match self {
TunnelPath::Single(s) => {
*s = format!("/{}/", s.trim().trim_matches('/'));
}
TunnelPath::Multiple(v) => {
for s in v.iter_mut() {
*s = format!("/{}/", s.trim().trim_matches('/'));
}
v.iter_mut().for_each(|s| {
*s = s.trim().trim_matches('/').to_string();
if !s.is_empty() {
*s = format!("/{}/", s);
}
});
v.retain(|s| !s.is_empty());
}
}
}
Expand Down

0 comments on commit be80732

Please sign in to comment.