mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-15 09:55:49 +01:00
(refs #1439)Fix pattern matching for assemble GitLFS URL
This commit is contained in:
@@ -64,11 +64,10 @@ class GitLfsTransferServlet extends HttpServlet {
|
||||
}
|
||||
|
||||
private def getPathInfo(req: HttpServletRequest, res: HttpServletResponse): Option[(String, String, String)] = {
|
||||
val paths = req.getRequestURI.substring(1).split("/")
|
||||
val owner = paths.dropRight(2).last
|
||||
val repository = paths.dropRight(1).last
|
||||
val oid = paths.last
|
||||
Some((owner, repository, oid))
|
||||
req.getRequestURI.substring(1).split("/").reverse match {
|
||||
case Array(oid, repository, owner, _*) => Some((owner, repository, oid))
|
||||
case _ => None
|
||||
}
|
||||
}
|
||||
|
||||
private def sendError(res: HttpServletResponse, status: Int, message: String): Unit = {
|
||||
|
||||
@@ -76,10 +76,8 @@ class GitRepositoryServlet extends GitServlet with SystemSettingsService {
|
||||
case Some(baseUrl) => {
|
||||
val index = req.getRequestURI.indexOf(".git")
|
||||
if(index >= 0){
|
||||
val paths = req.getRequestURI.substring(0, index).split("/")
|
||||
val owner = paths.dropRight(1).last
|
||||
val repository = paths.last
|
||||
|
||||
req.getRequestURI.substring(0, index).split("/").reverse match {
|
||||
case Array(repository, owner, _*) =>
|
||||
val timeout = System.currentTimeMillis + (60000 * 10) // 10 min.
|
||||
val batchResponse = batchRequest.operation match {
|
||||
case "upload" =>
|
||||
@@ -118,6 +116,7 @@ class GitRepositoryServlet extends GitServlet with SystemSettingsService {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class GitBucketRepositoryResolver(parent: FileResolver[HttpServletRequest]) extends RepositoryResolver[HttpServletRequest] {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user