Skip to content

Commit

Permalink
Utils: parse::query doesn't add empty keys.
Browse files Browse the repository at this point in the history
Before, an empty query would return a empty KeyValuePair.
  • Loading branch information
Icelk committed Jan 7, 2022
1 parent 7c92626 commit 957b9db
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions utils/src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,9 @@ pub fn query(query: &str) -> Query {
let value = query.get(value_start..position);

if let (Some(key), Some(value)) = (key, value) {
map.insert(percent_decode(key), percent_decode(value));
if !key.is_empty() {
map.insert(percent_decode(key), percent_decode(value));
}
}

pair_start = position + 1;
Expand All @@ -628,7 +630,9 @@ pub fn query(query: &str) -> Query {
let value = query.get(value_start..);

if let (Some(key), Some(value)) = (key, value) {
map.insert(percent_decode(key), percent_decode(value));
if !key.is_empty() {
map.insert(percent_decode(key), percent_decode(value));
}
}
}
map
Expand Down

0 comments on commit 957b9db

Please sign in to comment.