always prefix lines without \t with i

pull/1/head
chris west 4 years ago
parent 67665c3327
commit 49ae7abb63

@ -287,10 +287,8 @@ fn gph_line_to_gopher(line: &str, req: &Request) -> String {
} else { } else {
match line.matches('\t').count() { match line.matches('\t').count() {
0 => { 0 => {
// Insert `i` prefix to any prefix-less lines without tabs. // Always insert `i` prefix to any lines without tabs.
if line.chars().nth(0) != Some('i') { line.insert(0, 'i');
line.insert(0, 'i');
}
line.push_str(&format!("\t(null)\t{}\t{}", req.host, req.port)) line.push_str(&format!("\t(null)\t{}\t{}", req.host, req.port))
} }
// Auto-add host and port to lines with just a selector. // Auto-add host and port to lines with just a selector.

Loading…
Cancel
Save