mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[github] Share Project: fix github host url for Enterprise. IDEA-101424
Instead of always using https://github.com, use the host defined in the settings.
This commit is contained in:
@@ -119,6 +119,16 @@ public class GithubApiUtil {
|
||||
return "https://" + getApiUrlWithoutProtocol(urlFromSettings);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the "host" part of Git URLs.
|
||||
* E.g.: https://github.com
|
||||
* Note: there is no trailing slash in the returned url.
|
||||
*/
|
||||
@NotNull
|
||||
public static String getGitHost() {
|
||||
return "https://" + removeTrailingSlash(removeProtocolPrefix(GithubSettings.getInstance().getHost()));
|
||||
}
|
||||
|
||||
/*
|
||||
All API access is over HTTPS, and accessed from the api.github.com domain
|
||||
(or through yourdomain.com/api/v3/ for enterprise).
|
||||
|
||||
@@ -218,7 +218,7 @@ public class GithubShareAction extends DumbAwareAction {
|
||||
final GitSimpleHandler addRemoteHandler = new GitSimpleHandler(project, root, GitCommand.REMOTE);
|
||||
addRemoteHandler.setNoSSH(true);
|
||||
addRemoteHandler.setSilent(true);
|
||||
final String remoteUrl = "https://github.com/" + login + "/" + name + ".git";
|
||||
final String remoteUrl = GithubApiUtil.getGitHost() + "/" + login + "/" + name + ".git";
|
||||
addRemoteHandler.addParameters("add", "origin", remoteUrl);
|
||||
try {
|
||||
addRemoteHandler.run();
|
||||
|
||||
Reference in New Issue
Block a user