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 19, 2024
1 parent 4e6f6d5 commit 3cb4517
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 3cb4517

Please sign in to comment.