Fix the repository url.

This commit is contained in:
takezoe
2013-06-16 03:20:34 +09:00
parent c3a4c36ac2
commit 676e6c6047
12 changed files with 48 additions and 40 deletions

View File

@@ -85,7 +85,7 @@ trait ReadableRepositoryAuthenticator { self: ControllerBase with RepositoryServ
private def authenticate(action: => Any) = {
{
val paths = request.getRequestURI.split("/")
getRepository(paths(1), paths(2), servletContext) match {
getRepository(paths(1), paths(2), baseUrl) match {
case None => NotFound()
case Some(repository) =>
if(repository.repository.repositoryType == RepositoryService.Public){

View File

@@ -110,10 +110,10 @@ object JGitUtil {
/**
* Returns the repository information. It contains branch names and tag names.
*/
def getRepositoryInfo(owner: String, repository: String, servletContext: ServletContext): RepositoryInfo = {
def getRepositoryInfo(owner: String, repository: String, baseUrl: String): RepositoryInfo = {
withGit(getRepositoryDir(owner, repository)){ git =>
RepositoryInfo(
owner, repository, "http://localhost:8080%s/git/%s/%s.git".format(servletContext.getContextPath, owner, repository),
owner, repository, baseUrl + "/git/%s/%s.git".format(owner, repository),
// branches
git.branchList.call.asScala.map { ref =>
ref.getName.replaceFirst("^refs/heads/", "")