Skip to content

Commit

Permalink
updated regexp groups to fetch artifactType
Browse files Browse the repository at this point in the history
  • Loading branch information
IsabellaDev committed Oct 19, 2020
1 parent 5c42e08 commit bc8fc6a
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,14 @@ func generateTargetArtifacts(w http.ResponseWriter, r *http.Request) {
name := mux.Vars(r)["name"]
plan := r.FormValue("plan")

re := regexp.MustCompile(`artifactType:\s.*`)
artifactTypematch := re.FindString(plan)
re := regexp.MustCompile(`artifactType:\s*(.+)`)
artifactTypematch := re.FindStringSubmatch(plan)
var artifactType string
if artifactTypematch == "" {
if len(artifactTypematch) == 0 {
artifactType = ""
} else {
match := []rune(artifactTypematch)
name := string(match[len("artifactType:"):len(match)])
artifactType = strings.Replace(name, " ", "", -1)

artifactType = strings.ReplaceAll(artifactTypematch[1], " ", "")
}

t := time.Now()
Expand Down

0 comments on commit bc8fc6a

Please sign in to comment.