Skip to content

Commit

Permalink
make module_name option optional
Browse files Browse the repository at this point in the history
  • Loading branch information
tmu-sprd committed Apr 14, 2024
1 parent e073c3d commit e457247
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions api/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ func (m ModuleController) DeployModule(c *gin.Context) {
module := data.ModuleName
overrideModule := c.Query("module_name")
// Restrictions to Puppet module names are: 1) begin with lowercase letter, 2) contain lowercase, digits or underscores
match, _ := regexp.MatchString("^[a-z][a-z0-9_]*$", overrideModule)
if !match {
c.JSON(http.StatusInternalServerError, gin.H{"message": "Invalid module name"})
c.Abort()
return
}
if overrideModule != "" {
match, _ := regexp.MatchString("^[a-z][a-z0-9_]*$", overrideModule)
if !match {
c.JSON(http.StatusInternalServerError, gin.H{"message": "Invalid module name"})
c.Abort()
return
}
module = overrideModule
}

Expand Down

0 comments on commit e457247

Please sign in to comment.