From c44adbd05cf9b3788f63fed7067122162850e36f Mon Sep 17 00:00:00 2001 From: Valentin Knabel Date: Thu, 21 Dec 2023 11:24:35 +0100 Subject: [PATCH] Fix submission namespace output when including dashes When a new provider or module has been submitted which included a `-` within the namespace of the Git repository, only the last portion of the user or organization was picked. See #125 as an example where `metal-stack-cloud/terraform-provider-metal` resulted in a errornous repository url of `https://github.com/cloud/terraform-provider-metal`. --- src/cmd/add-module/main.go | 2 +- src/cmd/add-provider/main.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cmd/add-module/main.go b/src/cmd/add-module/main.go index a03b556ebe..48ebaa7a6a 100644 --- a/src/cmd/add-module/main.go +++ b/src/cmd/add-module/main.go @@ -45,7 +45,7 @@ func main() { err = func() error { // Lower case input - re := regexp.MustCompile("(?P[a-zA-Z0-9]+)/terraform-(?P[a-zA-Z0-9]*)-(?P[a-zA-Z0-9-]*)") + re := regexp.MustCompile("(?P[a-zA-Z0-9-]+)/terraform-(?P[a-zA-Z0-9]*)-(?P[a-zA-Z0-9-]*)") match := re.FindStringSubmatch(*repository) if match == nil { return fmt.Errorf("Invalid repository name: %s", *repository) diff --git a/src/cmd/add-provider/main.go b/src/cmd/add-provider/main.go index 4f9f516760..95ccdfc716 100644 --- a/src/cmd/add-provider/main.go +++ b/src/cmd/add-provider/main.go @@ -44,7 +44,7 @@ func main() { err = func() error { // Lower case input - re := regexp.MustCompile("(?P[a-zA-Z0-9]+)/terraform-provider-(?P[a-zA-Z0-9-]*)") + re := regexp.MustCompile("(?P[a-zA-Z0-9-]+)/terraform-provider-(?P[a-zA-Z0-9-]*)") match := re.FindStringSubmatch(strings.ToLower(*repository)) if match == nil { return fmt.Errorf("Invalid repository name: %s", *repository)