diff options
author | James Moger <james.moger@gitblit.com> | 2013-11-29 20:06:09 -0500 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2013-12-30 16:53:58 -0500 |
commit | 14cbbeaf61ce67c1ef5a6445515f3134dd5690ce (patch) | |
tree | c90f1e0bec0d65a4e54725b21caff52de5bc8a39 /src/main/java/com/gitblit/git/GitblitReceivePackFactory.java | |
parent | afaab55bf4f309382b55793db44033233dcfb64d (diff) | |
download | gitblit-14cbbeaf61ce67c1ef5a6445515f3134dd5690ce.tar.gz gitblit-14cbbeaf61ce67c1ef5a6445515f3134dd5690ce.zip |
New canonical base url setting for repository urls and notifications
Change-Id: I86a1eb61c2351d1cf3f6b3becf00f2a36d5c8ed6
Diffstat (limited to 'src/main/java/com/gitblit/git/GitblitReceivePackFactory.java')
-rw-r--r-- | src/main/java/com/gitblit/git/GitblitReceivePackFactory.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/main/java/com/gitblit/git/GitblitReceivePackFactory.java b/src/main/java/com/gitblit/git/GitblitReceivePackFactory.java index bdf9b1ad..b8b49bcd 100644 --- a/src/main/java/com/gitblit/git/GitblitReceivePackFactory.java +++ b/src/main/java/com/gitblit/git/GitblitReceivePackFactory.java @@ -63,7 +63,6 @@ public class GitblitReceivePackFactory<X> implements ReceivePackFactory<X> { String repositoryName = ""; String origin = ""; String gitblitUrl = ""; - String repositoryUrl = ""; int timeout = 0; if (req instanceof HttpServletRequest) { @@ -72,7 +71,6 @@ public class GitblitReceivePackFactory<X> implements ReceivePackFactory<X> { repositoryName = request.getAttribute("gitblitRepositoryName").toString(); origin = request.getRemoteHost(); gitblitUrl = HttpUtils.getGitblitURL(request); - repositoryUrl = request.getRequestURI(); // determine pushing user String username = request.getRemoteUser(); @@ -98,11 +96,15 @@ public class GitblitReceivePackFactory<X> implements ReceivePackFactory<X> { throw new ServiceNotEnabledException(); } + String url = settings.getString(Keys.web.canonicalUrl, null); + if (StringUtils.isEmpty(url)) { + url = gitblitUrl; + } + final RepositoryModel repository = gitblit.getRepositoryModel(repositoryName); final GitblitReceivePack rp = new GitblitReceivePack(gitblit, db, repository, user); - rp.setGitblitUrl(gitblitUrl); - rp.setRepositoryUrl(repositoryUrl); + rp.setGitblitUrl(url); rp.setRefLogIdent(new PersonIdent(user.username, user.username + "@" + origin)); rp.setTimeout(timeout); |