Browse Source

[gopher] Fix parsing of h type

Was parsed after trying to match "://" so it never matched.
tags/0.8.4^0
Julien Blanchard 1 year ago
parent
commit
193de0c207
3 changed files with 10 additions and 10 deletions
  1. 1
    1
      Cargo.lock
  2. 1
    1
      Cargo.toml
  3. 8
    8
      src/gopher/link.rs

+ 1
- 1
Cargo.lock View File

@@ -136,7 +136,7 @@ dependencies = [
136 136
 
137 137
 [[package]]
138 138
 name = "castor"
139
-version = "0.8.3"
139
+version = "0.8.4"
140 140
 dependencies = [
141 141
  "ansi-parser 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
142 142
  "dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)",

+ 1
- 1
Cargo.toml View File

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

+ 8
- 8
src/gopher/link.rs View File

@@ -108,14 +108,6 @@ impl FromStr for Link {
108 108
                 Some(link) => Ok(link),
109 109
                 None => Err(ParseError),
110 110
             }
111
-        } else if line.contains("://") {
112
-            let url = String::from(line);
113
-            let label = String::from(line);
114
-
115
-            match make_link(url, label) {
116
-                Some(link) => Ok(link),
117
-                None => Err(ParseError),
118
-            }
119 111
         } else if line.starts_with('h') {
120 112
             let label = els.next();
121 113
             let url = els.next();
@@ -136,6 +128,14 @@ impl FromStr for Link {
136 128
             } else {
137 129
                 Err(ParseError)
138 130
             }
131
+        } else if line.contains("://") {
132
+            let url = String::from(line);
133
+            let label = String::from(line);
134
+
135
+            match make_link(url, label) {
136
+                Some(link) => Ok(link),
137
+                None => Err(ParseError),
138
+            }
139 139
         } else {
140 140
             Err(ParseError)
141 141
         }

Loading…
Cancel
Save