fix: can't resolve the git repository path provided by the plugin

If the contextPath is not equals to `/`, gitRepositoryPath contains
the contextPath + `/git`.  Therefore, gitbucket can not resolve
the git repository path provided by the plugin.

For example, you can not clone the snippets repository of gist-plugin.

To fix this, also deletes contextPath from requestURI.
This commit is contained in:
Mitsuhiro Koga
2016-07-25 22:43:51 +09:00
parent 8d35494169
commit 485516be2e

View File

@@ -73,7 +73,7 @@ object Implicits {
def hasAttribute(name: String): Boolean = request.getAttribute(name) != null def hasAttribute(name: String): Boolean = request.getAttribute(name) != null
def gitRepositoryPath: String = request.getRequestURI.replaceFirst("^/git/", "/") def gitRepositoryPath: String = request.getRequestURI.replaceFirst("^" + request.getContextPath + "/git/", "/")
def baseUrl:String = { def baseUrl:String = {
val url = request.getRequestURL.toString val url = request.getRequestURL.toString