mirror of
https://github.com/NixOS/nix.git
synced 2025-11-09 20:16:03 +01:00
decodeQuery Take std::string_view not string ref
(cherry picked from commit 4083eff0c0)
This commit is contained in:
parent
f777aa70d3
commit
752d0ef1c0
2 changed files with 3 additions and 3 deletions
|
|
@ -82,7 +82,7 @@ std::pair<FlakeRef, std::string> parsePathFlakeRefWithFragment(
|
||||||
auto succeeds = std::regex_match(url, match, pathFlakeRegex);
|
auto succeeds = std::regex_match(url, match, pathFlakeRegex);
|
||||||
assert(succeeds);
|
assert(succeeds);
|
||||||
auto path = match[1].str();
|
auto path = match[1].str();
|
||||||
auto query = decodeQuery(match[3]);
|
auto query = decodeQuery(match[3].str());
|
||||||
auto fragment = percentDecode(match[5].str());
|
auto fragment = percentDecode(match[5].str());
|
||||||
|
|
||||||
if (baseDir) {
|
if (baseDir) {
|
||||||
|
|
|
||||||
|
|
@ -179,7 +179,7 @@ try {
|
||||||
.scheme = scheme,
|
.scheme = scheme,
|
||||||
.authority = authority,
|
.authority = authority,
|
||||||
.path = path,
|
.path = path,
|
||||||
.query = decodeQuery(std::string(query)),
|
.query = decodeQuery(query),
|
||||||
.fragment = fragment,
|
.fragment = fragment,
|
||||||
};
|
};
|
||||||
} catch (boost::system::system_error & e) {
|
} catch (boost::system::system_error & e) {
|
||||||
|
|
@ -201,7 +201,7 @@ std::string percentEncode(std::string_view s, std::string_view keep)
|
||||||
s, [keep](char c) { return boost::urls::unreserved_chars(c) || keep.find(c) != keep.npos; });
|
s, [keep](char c) { return boost::urls::unreserved_chars(c) || keep.find(c) != keep.npos; });
|
||||||
}
|
}
|
||||||
|
|
||||||
StringMap decodeQuery(const std::string & query)
|
StringMap decodeQuery(std::string_view query)
|
||||||
try {
|
try {
|
||||||
/* For back-compat unescaped characters are allowed. */
|
/* For back-compat unescaped characters are allowed. */
|
||||||
auto fixedEncodedQuery = percentEncodeCharSet(query, extraAllowedCharsInQuery);
|
auto fixedEncodedQuery = percentEncodeCharSet(query, extraAllowedCharsInQuery);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue