1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 10:41:16 +02:00

Fix url parsing for urls using file+

`file+https://example.org/test.mp4` should not be rejected with
`unexpected authority`.
This commit is contained in:
Eric Wolf 2023-01-20 10:31:26 +01:00
parent b911307d7a
commit 4d50995eff
2 changed files with 24 additions and 3 deletions

View file

@ -30,13 +30,13 @@ ParsedURL parseURL(const std::string & url)
auto & query = match[6];
auto & fragment = match[7];
auto isFile = scheme.find("file") != std::string::npos;
auto transportIsFile = parseUrlScheme(scheme).transport == "file";
if (authority && *authority != "" && isFile)
if (authority && *authority != "" && transportIsFile)
throw BadURL("file:// URL '%s' has unexpected authority '%s'",
url, *authority);
if (isFile && path.empty())
if (transportIsFile && path.empty())
path = "/";
return ParsedURL{