Commit 60d7ae97 authored by Marin Jankovski's avatar Marin Jankovski

First take on uploading lfs object.

parent bb3566b5
...@@ -59,8 +59,14 @@ var gitServices = [...]gitService{ ...@@ -59,8 +59,14 @@ var gitServices = [...]gitService{
gitService{"GET", "/repository/archive.tar", handleGetArchive, "tar"}, gitService{"GET", "/repository/archive.tar", handleGetArchive, "tar"},
gitService{"GET", "/repository/archive.tar.gz", handleGetArchive, "tar.gz"}, gitService{"GET", "/repository/archive.tar.gz", handleGetArchive, "tar.gz"},
gitService{"GET", "/repository/archive.tar.bz2", handleGetArchive, "tar.bz2"}, gitService{"GET", "/repository/archive.tar.bz2", handleGetArchive, "tar.bz2"},
gitService{"PUT", "/gitlab-lfs/objects", handleStoreLfsObject, "lfs-object-receive"},
} }
var (
errHashMismatch = errors.New("Content hash does not match OID")
errSizeMismatch = errors.New("Content size does not match")
)
func newGitHandler(authBackend string, authTransport http.RoundTripper) *gitHandler { func newGitHandler(authBackend string, authTransport http.RoundTripper) *gitHandler {
return &gitHandler{&http.Client{Transport: authTransport}, authBackend} return &gitHandler{&http.Client{Transport: authTransport}, authBackend}
} }
...@@ -73,7 +79,7 @@ func (h *gitHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { ...@@ -73,7 +79,7 @@ func (h *gitHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// Look for a matching Git service // Look for a matching Git service
foundService := false foundService := false
for _, g = range gitServices { for _, g = range gitServices {
if r.Method == g.method && strings.HasSuffix(r.URL.Path, g.suffix) { if r.Method == g.method && strings.Contains(r.URL.Path, g.suffix) {
foundService = true foundService = true
break break
} }
......
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