Skip to content
This repository has been archived by the owner on Aug 10, 2018. It is now read-only.

Commit

Permalink
Replace regexp with strings.HasSuffix
Browse files Browse the repository at this point in the history
  • Loading branch information
tmaczukin committed Aug 30, 2016
1 parent a8c8986 commit ab608d6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions network/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"net/url"
"os"
"path/filepath"
"regexp"
"strings"
"time"
)
Expand Down Expand Up @@ -200,8 +199,10 @@ func (n *client) doJSON(uri, method string, statusCode int, request interface{},

func fixCIURL(url string) string {
url = strings.TrimRight(url, "/")
re := regexp.MustCompile("(/ci)?$")
return re.ReplaceAllString(url, "/ci")
if !strings.HasSuffix(url, "/ci") {
url += "/ci"
}
return url
}

func newClient(config common.RunnerCredentials) (c *client, err error) {
Expand Down

0 comments on commit ab608d6

Please sign in to comment.