mirror of
https://github.com/NixOS/nix.git
synced 2025-11-30 14:10:59 +01:00
libutil: Fix renderAuthorityAndPath unreachable for path:/ URLs
This was mistakenly triggered by path:/ URL, since the `//` would
correspond to 3 empty segments.
(cherry picked from commit 1d8dd77e1d)
This commit is contained in:
parent
72e3dd396c
commit
98b7654390
2 changed files with 14 additions and 1 deletions
|
|
@ -350,7 +350,7 @@ std::string ParsedURL::renderAuthorityAndPath() const
|
|||
must either be empty or begin with a slash ("/") character. */
|
||||
assert(path.empty() || path.front().empty());
|
||||
res += authority->to_string();
|
||||
} else if (std::ranges::equal(std::views::take(path, 2), std::views::repeat("", 2))) {
|
||||
} else if (std::ranges::equal(std::views::take(path, 3), std::views::repeat("", 3))) {
|
||||
/* If a URI does not contain an authority component, then the path cannot begin
|
||||
with two slash characters ("//") */
|
||||
unreachable();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue