mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-15 02:36:16 +02:00
fix: Error on malformed URI query parameter
Signed-off-by: Bryan Honof <bryanhonof@gmail.com>
This commit is contained in:
parent
85f1aa6b3d
commit
c9f45677b5
1 changed files with 9 additions and 4 deletions
|
@ -79,10 +79,15 @@ std::map<std::string, std::string> decodeQuery(const std::string & query)
|
||||||
|
|
||||||
for (auto s : tokenizeString<Strings>(query, "&")) {
|
for (auto s : tokenizeString<Strings>(query, "&")) {
|
||||||
auto e = s.find('=');
|
auto e = s.find('=');
|
||||||
if (e != std::string::npos)
|
|
||||||
result.emplace(
|
if (e == std::string::npos) {
|
||||||
s.substr(0, e),
|
warn("invalid URI query '%s', did you forget an equals sign `=`?", s);
|
||||||
percentDecode(std::string_view(s).substr(e + 1)));
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
result.emplace(
|
||||||
|
s.substr(0, e),
|
||||||
|
percentDecode(std::string_view(s).substr(e + 1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Reference in a new issue