Commit 28c9928c authored by Jacob Vosmaer's avatar Jacob Vosmaer

Declare params structs outside Inject functions

parent 46680f42
...@@ -21,16 +21,17 @@ import ( ...@@ -21,16 +21,17 @@ import (
) )
type archive struct{ senddata.Prefix } type archive struct{ senddata.Prefix }
type archiveParams struct {
RepoPath string
ArchivePath string
ArchivePrefix string
CommitId string
}
var SendArchive = &archive{"git-archive:"} var SendArchive = &archive{"git-archive:"}
func (a *archive) Inject(w http.ResponseWriter, r *http.Request, sendData string) { func (a *archive) Inject(w http.ResponseWriter, r *http.Request, sendData string) {
var params struct { var params archiveParams
RepoPath string
ArchivePath string
ArchivePrefix string
CommitId string
}
if err := a.Unpack(&params, sendData); err != nil { if err := a.Unpack(&params, sendData); err != nil {
helper.Fail500(w, fmt.Errorf("SendArchive: unpack sendData: %v", err)) helper.Fail500(w, fmt.Errorf("SendArchive: unpack sendData: %v", err))
return return
......
...@@ -10,11 +10,12 @@ import ( ...@@ -10,11 +10,12 @@ import (
) )
type blob struct{ senddata.Prefix } type blob struct{ senddata.Prefix }
type blobParams struct{ RepoPath, BlobId string }
var SendBlob = &blob{"git-blob:"} var SendBlob = &blob{"git-blob:"}
func (b *blob) Inject(w http.ResponseWriter, r *http.Request, sendData string) { func (b *blob) Inject(w http.ResponseWriter, r *http.Request, sendData string) {
var params struct{ RepoPath, BlobId string } var params blobParams
if err := b.Unpack(&params, sendData); err != nil { if err := b.Unpack(&params, sendData); err != nil {
helper.Fail500(w, fmt.Errorf("SendBlob: unpack sendData: %v", err)) helper.Fail500(w, fmt.Errorf("SendBlob: unpack sendData: %v", err))
return return
......
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