mirror of
https://github.com/gitbucket/gitbucket.git
synced 2026-05-06 09:57:13 +02:00
Merge pull request #1921 from gitbucket/path-end-slash
Support all of paths which end with slash
This commit is contained in:
@@ -77,7 +77,7 @@ trait ApiControllerBase extends ControllerBase {
|
||||
/**
|
||||
* https://developer.github.com/v3/#root-endpoint
|
||||
*/
|
||||
get("/api/v3/") {
|
||||
get("/api/v3") {
|
||||
JsonFormat(ApiEndPoint())
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,15 @@ abstract class ControllerBase extends ScalatraFilter
|
||||
contentType = formats("json")
|
||||
}
|
||||
|
||||
override def requestPath(uri: String, idx: Int): String = {
|
||||
val path = super.requestPath(uri, idx)
|
||||
if(path != "/" && path.endsWith("/")){
|
||||
path.substring(0, path.length - 1)
|
||||
} else {
|
||||
path
|
||||
}
|
||||
}
|
||||
|
||||
override def doFilter(request: ServletRequest, response: ServletResponse, chain: FilterChain): Unit = try {
|
||||
val httpRequest = request.asInstanceOf[HttpServletRequest]
|
||||
val context = request.getServletContext.getContextPath
|
||||
|
||||
@@ -109,7 +109,7 @@ trait WikiControllerBase extends ControllerBase {
|
||||
val Array(from, to) = params("commitId").split("\\.\\.\\.")
|
||||
|
||||
if(revertWikiPage(repository.owner, repository.name, from, to, context.loginAccount.get, None)){
|
||||
redirect(s"/${repository.owner}/${repository.name}/wiki/")
|
||||
redirect(s"/${repository.owner}/${repository.name}/wiki")
|
||||
} else {
|
||||
flash += "info" -> "This patch was not able to be reversed."
|
||||
redirect(s"/${repository.owner}/${repository.name}/wiki/_compare/${from}...${to}")
|
||||
|
||||
Reference in New Issue
Block a user