diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2021-11-18 12:30:29 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-18 12:30:29 +0100 |
commit | 0adced4b9e954f2643a9eaac78f8e95a9f58437f (patch) | |
tree | ca6763c127fed8658dfa5b420b43b663b2737ffb | |
parent | 262a3c7ce332d8f7f52b007178c2d54f063d6c7a (diff) | |
parent | 46d2a5a10be7e48679a29d487adbb6f1d6fd452a (diff) |
Merge pull request #5580 from ksonj/fix/non-standard-ssh
Fix detection of scp-style URIs to support non-standard SSH ports
-rw-r--r-- | src/libexpr/primops/fetchTree.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libexpr/primops/fetchTree.cc b/src/libexpr/primops/fetchTree.cc index e6becdafc..079513873 100644 --- a/src/libexpr/primops/fetchTree.cc +++ b/src/libexpr/primops/fetchTree.cc @@ -74,7 +74,10 @@ std::string fixURI(std::string uri, EvalState & state, const std::string & defau std::string fixURIForGit(std::string uri, EvalState & state) { - static std::regex scp_uri("([^/].*)@(.*):(.*)"); + /* Detects scp-style uris (e.g. git@github.com:NixOS/nix) and fixes + * them by removing the `:` and assuming a scheme of `ssh://` + * */ + static std::regex scp_uri("([^/]*)@(.*):(.*)"); if (uri[0] != '/' && std::regex_match(uri, scp_uri)) return fixURI(std::regex_replace(uri, scp_uri, "$1@$2/$3"), state, "ssh"); else |