Skip to content

Commit

Permalink
chore: fix potentially buggy split of string into lines (#4863)
Browse files Browse the repository at this point in the history
  • Loading branch information
hnidoaht-101 authored Oct 27, 2022
1 parent f978507 commit a44c298
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,7 @@ impl LogTab {
Err(err) => format!("Error reading log : {}", err),
};
// Convert the content into Spans
let mut text: Vec<Spans> = content
.split('\n')
.map(|line| self.format_line(line.to_string()))
.collect();
let mut text: Vec<Spans> = content.lines().map(|line| self.format_line(line.to_string())).collect();
// We want newest at the top
text.reverse();
// Render the Paragraph
Expand Down
2 changes: 1 addition & 1 deletion comms/core/src/tor/control_client/parsers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ pub fn key_value(line: &str) -> Result<(Cow<'_, str>, Vec<Cow<'_, str>>), ParseE
let (rest, identifier) = take_while1(|ch| ch != '=')(line)?;
let (rest, _) = chr('=')(rest)?;

let lines = rest.split('\n');
let lines = rest.lines();
let parts = lines
.filter(|s| !s.is_empty())
.flat_map(|line| {
Expand Down

0 comments on commit a44c298

Please sign in to comment.