fix: preserve leading empty string if site creator is mentally deficient and has an empty item name in gophermap

master
Lukáš Hozda 4 years ago
parent 3a0a3c3c1d
commit 53c88d4fb7

@ -68,7 +68,7 @@ impl BrowserState {
parsed_selector: String::new(),
bookmarks: Vec::new(),
config: Config {
start_uri: String::from("gopher://gopher.floodgap.com:70"),
start_uri: String::from("gopher://r-36.net:70"),
cmd_text: String::from("less"),
cmd_image: String::from("display"),
cmd_browser: String::from("firefox"),
@ -221,9 +221,11 @@ impl BrowserState {
pub fn handle_directory_line(&mut self, line: &str) {
let fields = {
let mut v = line[1..].split('\t').collect::<Vec<_>>();
v.retain(|x| !x.is_empty());
v
line[1..].split('\t')
.enumerate()
.filter(|(i, x)| *i == 0 || !x.is_empty())
.map(|(_, x)| x)
.collect::<Vec<_>>()
};
/* determine listing type */
match line.chars().next() {

Loading…
Cancel
Save