Skip to content

Commit

Permalink
fix(api/repo): validation check for pipeline_type (#474)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrockopp authored Aug 26, 2021
1 parent 943f4e9 commit 417e15f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions api/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,11 @@ func CreateRepo(c *gin.Context) {
r.SetPipelineType(constants.PipelineTypeYAML)
} else {
// ensure the pipeline type matches one of the expected values
if input.GetPipelineType() != constants.PipelineTypeYAML ||
input.GetPipelineType() != constants.PipelineTypeGo ||
if input.GetPipelineType() != constants.PipelineTypeYAML &&
input.GetPipelineType() != constants.PipelineTypeGo &&
input.GetPipelineType() != constants.PipelineTypeStarlark {
retErr := fmt.Errorf("pipeline_type of %s is invalid", input.GetPipelineType())
// nolint: lll // ignore long line length due to error message
retErr := fmt.Errorf("unable to create new repo %s: invalid pipeline_type provided %s", r.GetFullName(), input.GetPipelineType())

util.HandleError(c, http.StatusBadRequest, retErr)

Expand Down

0 comments on commit 417e15f

Please sign in to comment.