From f417e6d8d7555dcb353e885cf00956dc0c857ab9 Mon Sep 17 00:00:00 2001 From: Quentin Perez Date: Mon, 13 Jun 2016 12:21:39 +0200 Subject: [PATCH 1/2] Fix panic when the commercial-type is lower than 2 charaters --- pkg/api/helpers.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/api/helpers.go b/pkg/api/helpers.go index 581a581bb3..8421b7aa6a 100644 --- a/pkg/api/helpers.go +++ b/pkg/api/helpers.go @@ -283,6 +283,9 @@ func CreateServer(api *ScalewayAPI, c *ConfigCreateServer) (string, error) { if commercialType == "" { commercialType = c.CommercialType } + if len(commercialType) < 2 { + return "", errors.New("Invalid commercial type") + } if c.Name == "" { c.Name = strings.Replace(namesgenerator.GetRandomName(0), "_", "-", -1) From b9d89980344301f78618c2b762350951ebef5477 Mon Sep 17 00:00:00 2001 From: Quentin Perez Date: Mon, 13 Jun 2016 12:22:47 +0200 Subject: [PATCH 2/2] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b82742238f..7d7f5337ae 100644 --- a/README.md +++ b/README.md @@ -1184,6 +1184,7 @@ $ scw inspect myserver | jq '.[0].public_ip.address' ### master (unreleased) +* Fix panic when the commercial-type is lower than 2 characters ([#365](https://github.com/scaleway/scaleway-cli/issues/365)) * gotty-client enable ProxyFromEnviromnent ([#363](https://github.com/scaleway/scaleway-cli/pull/363)) ([@debovema](https://github.com/debovema)) * `scw inspect` fix panic ([#353](https://github.com/scaleway/scaleway-cli/issues/353)) * Clear cache between the releases ([#329](https://github.com/scaleway/scaleway-cli/issues/329))