1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-09-19 10:50:24 -04:00

Merge pull request #10844 from NixOS/backport-9897-to-2.20-maintenance

[Backport 2.20-maintenance] libutil/url: fix git+file:./ parse error
This commit is contained in:
Robert Hensing 2024-06-04 11:04:38 +02:00 committed by GitHub
commit d78915d211
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -171,16 +171,16 @@ std::string fixGitURL(const std::string & url)
std::regex scpRegex("([^/]*)@(.*):(.*)");
if (!hasPrefix(url, "/") && std::regex_match(url, scpRegex))
return std::regex_replace(url, scpRegex, "ssh://$1@$2/$3");
else {
if (url.find("://") == std::string::npos) {
return (ParsedURL {
.scheme = "file",
.authority = "",
.path = url
}).to_string();
} else
return url;
if (hasPrefix(url, "file:"))
return url;
if (url.find("://") == std::string::npos) {
return (ParsedURL {
.scheme = "file",
.authority = "",
.path = url
}).to_string();
}
return url;
}
// https://www.rfc-editor.org/rfc/rfc3986#section-3.1