Skip to content

Commit

Permalink
update: Changing returned match from m[1] to m[2] to handle the optio…
Browse files Browse the repository at this point in the history
…n of git-codecommit vs git-codecommit-fips
  • Loading branch information
vmwmk committed May 19, 2023
1 parent 90b88aa commit 39897ac
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/awsv4/signer.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import (
)

var (
// urlRgx = regexp.MustCompile(`^https://git-codecommit\.(.*)\.(amazonaws\.com|amazonaws\.com\.cn)/v1/repos/.*$`)
urlRgx = regexp.MustCompile(`^https://(git-codecommit|git-codecommit-fips)\.(.*)\.(amazonaws\.com|amazonaws\.com\.cn)/v1/repos/.*$`)
)

Expand Down Expand Up @@ -92,7 +93,8 @@ func (s *Signer) Sign(cloneURL string) (string, error) {

func identifyRegion(url string) (string, error) {
if m := urlRgx.FindStringSubmatch(url); len(m) > 1 {
return m[1], nil
// return m[2], errors.New(fmt.Sprintf("found submatch: %s", m[2]))
return m[2], nil
}

return "", errors.New("no region found in malformed codecommit URL")
Expand Down

0 comments on commit 39897ac

Please sign in to comment.