8000 Handle ssh:// URLs that doesn't contain git@ · github-cloud/github-plugin@590bd09 · GitHub
[go: up one dir, main page]

Skip to content

Commit 590bd09

Browse files
committed
Handle ssh:// URLs that doesn't contain git@
It is possible to specify and use github.com URLs as ssh://github.com/username/repo, as credentials used for SCM configuration usually include username. This change would allow to properly parse such URLs.
1 parent c43344a commit 590bd09

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/java/com/cloudbees/jenkins/GitHubRepositoryName.java

Lines changed: 2 additions & 2 deletions
7839
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public class GitHubRepositoryName {
4949
Pattern.compile("https?://[^/]+@([^/]+)/([^/]+)/([^/]+)\\.git"),
5050
Pattern.compile("https?://([^/]+)/([^/]+)/([^/]+)\\.git"),
5151
Pattern.compile("git://([^/]+)/([^/]+)/([^/]+)\\.git"),
52-
Pattern.compile("ssh://git@([^/]+)/([^/]+)/([^/]+)\\.git"),
52+
Pattern.compile("ssh://(?:git@)?([^/]+)/([^/]+)/([^/]+)\\.git"),
5353
/**
5454
* The second set of patterns extract the host, owner and repository names
5555
* from all other URLs. Note that these patterns must be processed *after*
@@ -60,7 +60,7 @@ public class GitHubRepositoryName {
6060
Pattern.compile("https?://[^/]+@([^/]+)/([^/]+)/([^/]+)/?"),
6161
Pattern.compile("https?://([^/]+)/([^/]+)/([^/]+)/?"),
6262
Pattern.compile("git://([^/]+)/([^/]+)/([^/]+)/?"),
63-
Pattern.compile("ssh://git@([^/]+)/([^/]+)/([^/]+)/?")
63+
Pattern.compile("ssh://(?:git@)?([^/]+)/([^/]+)/([^/]+)/?")
6464
};
6565

6666
/**

0 commit comments

Comments
 (0)
0