~exprez135/castor

193de0c2079abf371286916b814804f34dd97087 — Julien Blanchard 3 years ago c8675c8 0.8.4
[gopher] Fix parsing of h type

Was parsed after trying to match "://" so it never matched.
3 files changed, 10 insertions(+), 10 deletions(-)

M Cargo.lock
M Cargo.toml
M src/gopher/link.rs
M Cargo.lock => Cargo.lock +1 -1
@@ 136,7 136,7 @@ dependencies = [

[[package]]
name = "castor"
version = "0.8.3"
version = "0.8.4"
dependencies = [
 "ansi-parser 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
 "dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)",

M Cargo.toml => Cargo.toml +1 -1
@@ 1,6 1,6 @@
[package]
name = "castor"
version = "0.8.3"
version = "0.8.4"
authors = ["Julien Blanchard <julien@typed-hole.org>"]
edition = "2018"


M src/gopher/link.rs => src/gopher/link.rs +8 -8
@@ 108,14 108,6 @@ impl FromStr for Link {
                Some(link) => Ok(link),
                None => Err(ParseError),
            }
        } else if line.contains("://") {
            let url = String::from(line);
            let label = String::from(line);

            match make_link(url, label) {
                Some(link) => Ok(link),
                None => Err(ParseError),
            }
        } else if line.starts_with('h') {
            let label = els.next();
            let url = els.next();


@@ 136,6 128,14 @@ impl FromStr for Link {
            } else {
                Err(ParseError)
            }
        } else if line.contains("://") {
            let url = String::from(line);
            let label = String::from(line);

            match make_link(url, label) {
                Some(link) => Ok(link),
                None => Err(ParseError),
            }
        } else {
            Err(ParseError)
        }