comments are ignored

pull/1/head
chris west 4 years ago
parent 1dd632e433
commit 08e3056f55

@ -247,6 +247,10 @@ where
/// Gopher-format line. Supports a basic format where lines without \t
/// get an `i` prefixed, and the geomyidae format.
fn gph_line_to_gopher(line: &str, req: &Request) -> String {
if line.starts_with('#') {
return "".to_string();
}
let mut line = line.trim_end_matches("\r").to_string();
if line.starts_with('[') && line.ends_with(']') && line.contains('|') {
// [1|name|sel|server|port]
@ -452,6 +456,7 @@ mod tests {
gph_line_to_gopher("[1|phkt.io|/|phkt.io]", &req),
"1phkt.io / phkt.io 70\r\n"
);
assert_eq!(gph_line_to_gopher("#[1|phkt.io|/|phkt.io]", &req), "");
assert_eq!(
gph_line_to_gopher("[1|sdf6000|/not-real|sdf.org|6000]", &req),
"1sdf6000 /not-real sdf.org 6000\r\n"

Loading…
Cancel
Save