Commit 70f191d2 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Move lfs into internal/lfs package

parent eba05966
......@@ -2,11 +2,12 @@
In this file we handle git lfs objects downloads and uploads
*/
package main
package lfs
import (
"./internal/api"
"./internal/helper"
"../api"
"../helper"
"../proxy"
"bytes"
"crypto/sha256"
"encoding/hex"
......@@ -19,6 +20,10 @@ import (
"path/filepath"
)
func PutStore(a *api.API, p *proxy.Proxy) http.HandlerFunc {
return lfsAuthorizeHandler(a, handleStoreLfsObject(p))
}
func lfsAuthorizeHandler(myAPI *api.API, handleFunc api.HandleFunc) http.HandlerFunc {
return myAPI.PreAuthorizeHandler(func(w http.ResponseWriter, r *http.Request, a *api.Response) {
......
......@@ -10,6 +10,7 @@ import (
"./internal/api"
"./internal/errorpage"
"./internal/git"
"./internal/lfs"
"./internal/proxy"
"fmt"
"log"
......@@ -54,7 +55,7 @@ func (u *upstream) compileRoutes() {
route{"GET", regexp.MustCompile(gitProjectPattern + `info/refs\z`), git.GetInfoRefs(u.API)},
route{"POST", regexp.MustCompile(gitProjectPattern + `git-upload-pack\z`), contentEncodingHandler(git.PostRPC(u.API))},
route{"POST", regexp.MustCompile(gitProjectPattern + `git-receive-pack\z`), contentEncodingHandler(git.PostRPC(u.API))},
route{"PUT", regexp.MustCompile(gitProjectPattern + `gitlab-lfs/objects/([0-9a-f]{64})/([0-9]+)\z`), lfsAuthorizeHandler(u.API, handleStoreLfsObject(u.Proxy))},
route{"PUT", regexp.MustCompile(gitProjectPattern + `gitlab-lfs/objects/([0-9a-f]{64})/([0-9]+)\z`), lfs.PutStore(u.API, u.Proxy)},
// Repository Archive
route{"GET", regexp.MustCompile(projectPattern + `repository/archive\z`), git.GetArchive(u.API)},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment