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

Loading…
Cancel
Save