mirror of
https://github.com/NixOS/nix.git
synced 2024-11-22 14:52:55 +00:00
Merge pull request #10843 from NixOS/backport-9897-to-2.19-maintenance
[Backport 2.19-maintenance] libutil/url: fix git+file:./ parse error
This commit is contained in:
commit
7e8ea6a843
@ -163,16 +163,16 @@ std::string fixGitURL(const std::string & url)
|
|||||||
std::regex scpRegex("([^/]*)@(.*):(.*)");
|
std::regex scpRegex("([^/]*)@(.*):(.*)");
|
||||||
if (!hasPrefix(url, "/") && std::regex_match(url, scpRegex))
|
if (!hasPrefix(url, "/") && std::regex_match(url, scpRegex))
|
||||||
return std::regex_replace(url, scpRegex, "ssh://$1@$2/$3");
|
return std::regex_replace(url, scpRegex, "ssh://$1@$2/$3");
|
||||||
else {
|
if (hasPrefix(url, "file:"))
|
||||||
|
return url;
|
||||||
if (url.find("://") == std::string::npos) {
|
if (url.find("://") == std::string::npos) {
|
||||||
return (ParsedURL {
|
return (ParsedURL {
|
||||||
.scheme = "file",
|
.scheme = "file",
|
||||||
.authority = "",
|
.authority = "",
|
||||||
.path = url
|
.path = url
|
||||||
}).to_string();
|
}).to_string();
|
||||||
} else
|
|
||||||
return url;
|
|
||||||
}
|
}
|
||||||
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.rfc-editor.org/rfc/rfc3986#section-3.1
|
// https://www.rfc-editor.org/rfc/rfc3986#section-3.1
|
||||||
|
Loading…
Reference in New Issue
Block a user