Skip to content
This repository has been archived by the owner on Jan 23, 2025. It is now read-only.

Commit

Permalink
Update regex to handle url correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
tbroden84 committed Feb 15, 2020
1 parent 3afa8f3 commit 1515dd4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion api/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ func (api *API) waitUntilDeletion(id string) error {
response, err := api.sling.New().Path("/api/instances/").Get(id).Receive(&data, &failed)

if err != nil {
log.Printf("[DEBUG] go-api::instance::waitUntilDeletion error: %v", err)
return err
}
if response.StatusCode == 404 {
log.Print("[DEBUG] go-api::instance::waitUntilDeletion deleted")
return nil
}

Expand Down Expand Up @@ -141,7 +143,7 @@ func (api *API) DeleteInstance(id string) error {

func (api *API) UrlInformation(url string) map[string]interface{} {
paramsMap := make(map[string]interface{})
r := regexp.MustCompile(`amqp:\/\/(?P<username>(.*)):(?P<password>(.*))@(?P<host>(.*))\/(?P<vhost>(.*))`)
r := regexp.MustCompile(`^.*:\/\/(?P<username>(.*)):(?P<password>(.*))@(?P<host>(.*))\/(?P<vhost>(.*))`)
match := r.FindStringSubmatch(url)

for i, value := range r.SubexpNames() {
Expand Down

0 comments on commit 1515dd4

Please sign in to comment.