mirror of
https://github.com/NixOS/nix
synced 2024-09-19 10:50:24 -04:00
Merge pull request #11349 from bryanhonof/bryanhonof.check-query-for-equals
Warn on malformed URI query parameter
This commit is contained in:
commit
b89eca9aec
|
@ -79,7 +79,12 @@ 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)
|
|
||||||
|
if (e == std::string::npos) {
|
||||||
|
warn("dubious URI query '%s' is missing equal sign '%s'", s, "=");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
result.emplace(
|
result.emplace(
|
||||||
s.substr(0, e),
|
s.substr(0, e),
|
||||||
percentDecode(std::string_view(s).substr(e + 1)));
|
percentDecode(std::string_view(s).substr(e + 1)));
|
||||||
|
|
Loading…
Reference in a new issue