|
@ -11,7 +11,6 @@ import ( |
|
|
"github.com/spf13/afero" |
|
|
"github.com/spf13/afero" |
|
|
"io" |
|
|
"io" |
|
|
"net/http" |
|
|
"net/http" |
|
|
"strings" |
|
|
|
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
const Name string = "Lithium" |
|
|
const Name string = "Lithium" |
|
@ -56,12 +55,25 @@ func UploadHandler(w http.ResponseWriter, r *http.Request, pipes []pipelines.IPi |
|
|
defer formFile.Close() |
|
|
defer formFile.Close() |
|
|
|
|
|
|
|
|
// check pipelines form param
|
|
|
// check pipelines form param
|
|
|
formPipelines := strings.Split(r.FormValue("pipelines"), ",") |
|
|
|
|
|
if len(formPipelines) == 0 { |
|
|
|
|
|
|
|
|
formPipeline := r.FormValue("pipeline") |
|
|
|
|
|
if formPipeline == "" { |
|
|
writeError(w, http.StatusUnprocessableEntity, "pipeline parameter missing") |
|
|
writeError(w, http.StatusUnprocessableEntity, "pipeline parameter missing") |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var execPipe pipelines.IPipeline |
|
|
|
|
|
for _, pipe := range pipes { |
|
|
|
|
|
if formPipeline == pipe.GetSlug() { |
|
|
|
|
|
execPipe = pipe |
|
|
|
|
|
break |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if execPipe == nil { |
|
|
|
|
|
writeError(w, http.StatusUnprocessableEntity, "pipeline not found") |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
bucket := r.FormValue("bucket") |
|
|
bucket := r.FormValue("bucket") |
|
|
if bucket == "" { |
|
|
if bucket == "" { |
|
|
writeError(w, http.StatusUnprocessableEntity, "bucket parameter missing") |
|
|
writeError(w, http.StatusUnprocessableEntity, "bucket parameter missing") |
|
|