From c1bfe0953c1445d27119148d6a29c5aa6bbde585 Mon Sep 17 00:00:00 2001 From: Tino Mueller Date: Sun, 14 Apr 2024 11:42:46 +0200 Subject: [PATCH] make module_name option optional --- api/module.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/api/module.go b/api/module.go index 436690d..26b9c70 100644 --- a/api/module.go +++ b/api/module.go @@ -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 }