diff options
| author | Andrew Guschin <guschin.drew@gmail.com> | 2022-04-04 12:42:14 +0400 |
|---|---|---|
| committer | Andrew Guschin <guschin.drew@gmail.com> | 2022-04-04 12:42:14 +0400 |
| commit | d60befcce09cf7e61b25ef7160a4ca991f3a368d (patch) | |
| tree | 5df5458449a44f6b654561531e064e71f1380e5f | |
| parent | 0a1d8409e49343427d26c4ddf0bf56d5b3e7b7d5 (diff) | |
| -rw-r--r-- | blog/src/querystring.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/blog/src/querystring.rs b/blog/src/querystring.rs index 8bb174a..dea6568 100644 --- a/blog/src/querystring.rs +++ b/blog/src/querystring.rs @@ -8,7 +8,9 @@ pub fn parse_qs(query: String) -> HashMap<String, String> { let mut map = HashMap::new(); for pair in query.split('&') { let pair = pair.split('=').collect::<Vec<&str>>(); - map.insert(pair[0].to_string(), pair[1].to_string()); + if pair.len() == 2 { + map.insert(pair[0].to_string(), pair[1].to_string()); + } } return map; } |