mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-07 22:15:45 +01:00
fix wrong commit and source url on git repositories with reverse proxy, see issue #483
This commit is contained in:
@@ -40,11 +40,11 @@ import com.google.common.collect.ImmutableMap;
|
|||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.common.io.Closeables;
|
import com.google.common.io.Closeables;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.name.Named;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import sonia.scm.config.ScmConfiguration;
|
||||||
import sonia.scm.repository.Branch;
|
import sonia.scm.repository.Branch;
|
||||||
import sonia.scm.repository.Branches;
|
import sonia.scm.repository.Branches;
|
||||||
import sonia.scm.repository.Changeset;
|
import sonia.scm.repository.Changeset;
|
||||||
@@ -60,7 +60,6 @@ import sonia.scm.template.TemplateEngineFactory;
|
|||||||
import sonia.scm.url.RepositoryUrlProvider;
|
import sonia.scm.url.RepositoryUrlProvider;
|
||||||
import sonia.scm.url.UrlProvider;
|
import sonia.scm.url.UrlProvider;
|
||||||
import sonia.scm.url.UrlProviderFactory;
|
import sonia.scm.url.UrlProviderFactory;
|
||||||
import sonia.scm.util.HttpUtil;
|
|
||||||
import sonia.scm.util.Util;
|
import sonia.scm.util.Util;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
@@ -104,13 +103,16 @@ public class GitRepositoryViewer
|
|||||||
*
|
*
|
||||||
* @param templateEngineFactory
|
* @param templateEngineFactory
|
||||||
* @param repositoryServiceFactory
|
* @param repositoryServiceFactory
|
||||||
|
* @param configuration
|
||||||
*/
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
public GitRepositoryViewer(TemplateEngineFactory templateEngineFactory,
|
public GitRepositoryViewer(TemplateEngineFactory templateEngineFactory,
|
||||||
RepositoryServiceFactory repositoryServiceFactory)
|
RepositoryServiceFactory repositoryServiceFactory,
|
||||||
|
ScmConfiguration configuration)
|
||||||
{
|
{
|
||||||
this.templateEngineFactory = templateEngineFactory;
|
this.templateEngineFactory = templateEngineFactory;
|
||||||
this.repositoryServiceFactory = repositoryServiceFactory;
|
this.repositoryServiceFactory = repositoryServiceFactory;
|
||||||
|
this.configuration = configuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- methods --------------------------------------------------------------
|
//~--- methods --------------------------------------------------------------
|
||||||
@@ -132,7 +134,7 @@ public class GitRepositoryViewer
|
|||||||
throws RepositoryException, IOException
|
throws RepositoryException, IOException
|
||||||
{
|
{
|
||||||
|
|
||||||
String baseUrl = HttpUtil.getCompleteUrl(request);
|
String baseUrl = configuration.getBaseUrl();
|
||||||
|
|
||||||
UrlProvider urlProvider = UrlProviderFactory.createUrlProvider(baseUrl,
|
UrlProvider urlProvider = UrlProviderFactory.createUrlProvider(baseUrl,
|
||||||
UrlProviderFactory.TYPE_WUI);
|
UrlProviderFactory.TYPE_WUI);
|
||||||
@@ -252,10 +254,10 @@ public class GitRepositoryViewer
|
|||||||
//~--- fields -------------------------------------------------------------
|
//~--- fields -------------------------------------------------------------
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private Iterable<ChangesetModel> changesets;
|
private final Iterable<ChangesetModel> changesets;
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private String name;
|
private final String name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -327,7 +329,7 @@ public class GitRepositoryViewer
|
|||||||
//~--- fields -------------------------------------------------------------
|
//~--- fields -------------------------------------------------------------
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private RepositoryService service;
|
private final RepositoryService service;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -369,7 +371,7 @@ public class GitRepositoryViewer
|
|||||||
//~--- fields -------------------------------------------------------------
|
//~--- fields -------------------------------------------------------------
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private Iterable<BranchModel> branches;
|
private final Iterable<BranchModel> branches;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -440,15 +442,18 @@ public class GitRepositoryViewer
|
|||||||
//~--- fields -------------------------------------------------------------
|
//~--- fields -------------------------------------------------------------
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private Changeset changeset;
|
private final Changeset changeset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//~--- fields ---------------------------------------------------------------
|
//~--- fields ---------------------------------------------------------------
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private RepositoryServiceFactory repositoryServiceFactory;
|
private final ScmConfiguration configuration;
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private TemplateEngineFactory templateEngineFactory;
|
private final RepositoryServiceFactory repositoryServiceFactory;
|
||||||
|
|
||||||
|
/** Field description */
|
||||||
|
private final TemplateEngineFactory templateEngineFactory;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user