aboutsummaryrefslogtreecommitdiff
path: root/src/libutil
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2022-04-11 11:15:14 +0200
committerGitHub <noreply@github.com>2022-04-11 11:15:14 +0200
commit092f6d2e7a88c4fa4cf0c507885eafef1b505c4a (patch)
tree484d3b4c42ceb3cb6d3c93fd659270d08580d700 /src/libutil
parent2311868aaa1743e6dbe4ad18c7e63262cf87fe72 (diff)
parentf3d3587ab39130e8d87d290b8cedabb3e6e9d715 (diff)
Merge pull request #6380 from thufschmitt/fix-double-slahsh-in-uri
Allow empty path segments in urls
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/tests/url.cc4
-rw-r--r--src/libutil/url-parts.hh2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/libutil/tests/url.cc b/src/libutil/tests/url.cc
index f20e2dc41..c3b233797 100644
--- a/src/libutil/tests/url.cc
+++ b/src/libutil/tests/url.cc
@@ -178,7 +178,7 @@ namespace nix {
}
TEST(parseURL, parseFileURLWithQueryAndFragment) {
- auto s = "file:///none/of/your/business";
+ auto s = "file:///none/of//your/business";
auto parsed = parseURL(s);
ParsedURL expected {
@@ -186,7 +186,7 @@ namespace nix {
.base = "",
.scheme = "file",
.authority = "",
- .path = "/none/of/your/business",
+ .path = "/none/of//your/business",
.query = (StringMap) { },
.fragment = "",
};
diff --git a/src/libutil/url-parts.hh b/src/libutil/url-parts.hh
index da10a6bbc..d5e6a2736 100644
--- a/src/libutil/url-parts.hh
+++ b/src/libutil/url-parts.hh
@@ -18,7 +18,7 @@ const static std::string userRegex = "(?:(?:" + unreservedRegex + "|" + pctEncod
const static std::string authorityRegex = "(?:" + userRegex + "@)?" + hostRegex + "(?::[0-9]+)?";
const static std::string pcharRegex = "(?:" + unreservedRegex + "|" + pctEncoded + "|" + subdelimsRegex + "|[:@])";
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 pathRegex = "(?:" + segmentRegex + "(?:/" + segmentRegex + ")*/?)";