Merge pull request #925 in YUNIONIO/onecloud from ~QIUJIAN/onecloud:hotfix/qj-os-type-case-insensitive to release/2.5.0

* commit '98bbe1a5c3d54dfb786729e82d6abaa6dc2c0a6d':
  image os type caseinsensitive
This commit is contained in:
邱剑
2019-01-15 12:03:30 +08:00
+1 -1
View File
@@ -463,7 +463,7 @@ func (this *ImageManager) _create(s *mcclient.ClientSession, params jsonutils.JS
if err != nil {
return nil, httperrors.NewMissingParameterError("os_type")
}
if !utils.IsInStringArray(osType, []string{"Windows", "Linux", "Freebsd", "Android", "macOS", "VMWare"}) {
if !utils.IsInStringArray(strings.ToLower(osType), []string{"windows", "linux", "freebsd", "android", "macos", "vmware"}) {
return nil, fmt.Errorf("OS type must be specified")
}
name, _ := params.GetString("name")