mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-29 17:16:15 +02:00
Allow empty path segments in urls
Valid per https://datatracker.ietf.org/doc/html/rfc3986#section-3.3 (and also somewhat frequently happening for local paths)
This commit is contained in:
parent
8b1e328d5d
commit
f3d3587ab3
2 changed files with 3 additions and 3 deletions
|
@ -178,7 +178,7 @@ namespace nix {
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(parseURL, parseFileURLWithQueryAndFragment) {
|
TEST(parseURL, parseFileURLWithQueryAndFragment) {
|
||||||
auto s = "file:///none/of/your/business";
|
auto s = "file:///none/of//your/business";
|
||||||
auto parsed = parseURL(s);
|
auto parsed = parseURL(s);
|
||||||
|
|
||||||
ParsedURL expected {
|
ParsedURL expected {
|
||||||
|
@ -186,7 +186,7 @@ namespace nix {
|
||||||
.base = "",
|
.base = "",
|
||||||
.scheme = "file",
|
.scheme = "file",
|
||||||
.authority = "",
|
.authority = "",
|
||||||
.path = "/none/of/your/business",
|
.path = "/none/of//your/business",
|
||||||
.query = (StringMap) { },
|
.query = (StringMap) { },
|
||||||
.fragment = "",
|
.fragment = "",
|
||||||
};
|
};
|
||||||
|
|
|
@ -18,7 +18,7 @@ const static std::string userRegex = "(?:(?:" + unreservedRegex + "|" + pctEncod
|
||||||
const static std::string authorityRegex = "(?:" + userRegex + "@)?" + hostRegex + "(?::[0-9]+)?";
|
const static std::string authorityRegex = "(?:" + userRegex + "@)?" + hostRegex + "(?::[0-9]+)?";
|
||||||
const static std::string pcharRegex = "(?:" + unreservedRegex + "|" + pctEncoded + "|" + subdelimsRegex + "|[:@])";
|
const static std::string pcharRegex = "(?:" + unreservedRegex + "|" + pctEncoded + "|" + subdelimsRegex + "|[:@])";
|
||||||
const static std::string queryRegex = "(?:" + pcharRegex + "|[/? \"])*";
|
const static std::string queryRegex = "(?:" + pcharRegex + "|[/? \"])*";
|
||||||
const static std::string segmentRegex = "(?:" + pcharRegex + "+)";
|
const static std::string segmentRegex = "(?:" + pcharRegex + "*)";
|
||||||
const static std::string absPathRegex = "(?:(?:/" + segmentRegex + ")*/?)";
|
const static std::string absPathRegex = "(?:(?:/" + segmentRegex + ")*/?)";
|
||||||
const static std::string pathRegex = "(?:" + segmentRegex + "(?:/" + segmentRegex + ")*/?)";
|
const static std::string pathRegex = "(?:" + segmentRegex + "(?:/" + segmentRegex + ")*/?)";
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue