diff --git a/handlers_nats.go b/handlers_nats.go index 1033fe6..c59bd33 100644 --- a/handlers_nats.go +++ b/handlers_nats.go @@ -616,7 +616,13 @@ func processesEventHandler(m *nats.Msg, message *RequestMessage) error { // If payload contains only name of the tech the default version for given image is selected. // Otherwise it can be passed in format tech:version. func enableTechEventHandler(m *nats.Msg, message *RequestMessage) error { - if !regexp.Match("[a-z0-9A-Z]*:?[0-9\.\-]*", []byte(message.Payload)) { + matched, err := regexp.Match(`[a-z0-9A-Z]*:?[0-9\.\-]*`, []byte(message.Payload)) + if err != nil { + log.Println("ERROR enable tech problem: " + err.Error()) + publish(message.AppName, "backend problem", true) + return err + } + if !matched { return errors.New("payload malformation, it has to be in format tech:version") } @@ -633,7 +639,7 @@ func enableTechEventHandler(m *nats.Msg, message *RequestMessage) error { version = parts[1] } - err := waitForApp(message.AppName) + err = waitForApp(message.AppName) if err != nil { log.Println("ERROR enable tech problem: " + err.Error()) publish(message.AppName, "backend problem", true)