mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-12-30 20:29:58 +01:00
Modify contextPath to the literal pattern
Because contextPath can contain some special chars.
This commit is contained in:
@@ -4,6 +4,8 @@ import gitbucket.core.api.JsonFormat
|
||||
import gitbucket.core.controller.Context
|
||||
import gitbucket.core.servlet.Database
|
||||
|
||||
import java.util.regex.Pattern.quote
|
||||
|
||||
import javax.servlet.http.{HttpSession, HttpServletRequest}
|
||||
|
||||
import scala.util.matching.Regex
|
||||
@@ -73,7 +75,7 @@ object Implicits {
|
||||
|
||||
def hasAttribute(name: String): Boolean = request.getAttribute(name) != null
|
||||
|
||||
def gitRepositoryPath: String = request.getRequestURI.replaceFirst("^" + request.getContextPath + "/git/", "/")
|
||||
def gitRepositoryPath: String = request.getRequestURI.replaceFirst("^" + quote(request.getContextPath) + "/git/", "/")
|
||||
|
||||
def baseUrl:String = {
|
||||
val url = request.getRequestURL.toString
|
||||
|
||||
Reference in New Issue
Block a user