mirror of
https://github.com/gitbucket/gitbucket.git
synced 2026-01-08 16:42:18 +01:00
Add forwarding GitHub compatible LFS url
This commit is contained in:
@@ -7,20 +7,21 @@ class PreProcessController extends PreProcessControllerBase
|
||||
trait PreProcessControllerBase extends ControllerBase {
|
||||
|
||||
/**
|
||||
* Provides GitHub compatible URLs for Git client.
|
||||
*
|
||||
* <ul>
|
||||
* <li>git clone http://localhost:8080/owner/repo</li>
|
||||
* <li>git clone http://localhost:8080/owner/repo.git</li>
|
||||
* </ul>
|
||||
*
|
||||
* @see https://git-scm.com/book/en/v2/Git-Internals-Transfer-Protocols
|
||||
* Provides GitHub compatible URLs (e.g. http://localhost:8080/owner/repo.git) for Git client.
|
||||
*/
|
||||
get("/*/*/info/refs") {
|
||||
val query = Option(request.getQueryString).map("?" + _).getOrElse("")
|
||||
halt(MovedPermanently(baseUrl + "/git" + request.getRequestURI + query))
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides GitHub compatible URLs for GitLFS client.
|
||||
*/
|
||||
post("/*/*/info/lfs/objects/batch") {
|
||||
val dispatcher = request.getRequestDispatcher("/git" + request.getRequestURI)
|
||||
dispatcher.forward(request, response)
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter requests from anonymous users.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user