diff --git a/src/main/scala/gitbucket/core/util/Authenticator.scala b/src/main/scala/gitbucket/core/util/Authenticator.scala index 5cc52a9..7dd8fd5 100644 --- a/src/main/scala/gitbucket/core/util/Authenticator.scala +++ b/src/main/scala/gitbucket/core/util/Authenticator.scala @@ -31,9 +31,8 @@ protected def ownerOnly[T](action: (T, RepositoryInfo) => Any) = (form: T) => { authenticate(action(form, _)) } private def authenticate(action: (RepositoryInfo) => Any) = { - val paths = request.paths - val userName = params.getOrElse("owner", paths(0)) - val repoName = params.getOrElse("repository", paths(1)) + val userName = params("owner") + val repoName = params("repository") getRepository(userName, repoName).map { repository => context.loginAccount match { case Some(x) if (x.isAdmin) => action(repository) @@ -89,9 +88,8 @@ protected def referrersOnly[T](action: (T, RepositoryInfo) => Any) = (form: T) => { authenticate(action(form, _)) } private def authenticate(action: (RepositoryInfo) => Any) = { - val paths = request.paths - val userName = params.getOrElse("owner", paths(0)) - val repoName = params.getOrElse("repository", paths(1)) + val userName = params("owner") + val repoName = params("repository") getRepository(userName, repoName).map { repository => if (isReadable(repository.repository, context.loginAccount)) { action(repository) @@ -112,9 +110,8 @@ } private def authenticate(action: (RepositoryInfo) => Any) = { - val paths = request.paths - val userName = params.getOrElse("owner", paths(0)) - val repoName = params.getOrElse("repository", paths(1)) + val userName = params("owner") + val repoName = params("repository") getRepository(userName, repoName).map { repository => context.loginAccount match { case Some(x) if (x.isAdmin) => action(repository) @@ -138,9 +135,8 @@ } private def authenticate(action: (RepositoryInfo) => Any) = { - val paths = request.paths - val userName = params.getOrElse("owner", paths(0)) - val repoName = params.getOrElse("repository", paths(1)) + val userName = params("owner") + val repoName = params("repository") getRepository(userName, repoName).map { repository => context.loginAccount match { case Some(x) if (x.isAdmin) => action(repository)