Skip to content

Commit

Permalink
simplified the logic of setting the value for artifactType
Browse files Browse the repository at this point in the history
Signed-off-by: Isabella Liu <isabellaliu77@gmail.com>
  • Loading branch information
IsabellaDev authored and ashokponkumar committed Oct 19, 2020
1 parent 915f883 commit 5c2e964
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"net/http"
"regexp"
"strconv"
"strings"
"time"

"github.com/konveyor/move2kube-api/internal/application"
Expand Down Expand Up @@ -182,14 +181,11 @@ func generateTargetArtifacts(w http.ResponseWriter, r *http.Request) {
name := mux.Vars(r)["name"]
plan := r.FormValue("plan")

re := regexp.MustCompile(`artifactType:\s*(.+)`)
re := regexp.MustCompile(`artifactType:\s*([^\s]+)`)
artifactTypematch := re.FindStringSubmatch(plan)
var artifactType string
if len(artifactTypematch) == 0 {
artifactType = ""
} else {

artifactType = strings.ReplaceAll(artifactTypematch[1], " ", "")
artifactType := ""
if len(artifactTypematch) > 1 {
artifactType = artifactTypematch[1]
}

t := time.Now()
Expand Down

0 comments on commit 5c2e964

Please sign in to comment.