Fix empty string comparison issues in the codebase (#16686)
Automatic Merge
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
200a56fa5a
Коммит
94c24eea20
@@ -843,7 +843,7 @@ func migrateAuthToLdapCmdF(command *cobra.Command, args []string) error {
|
||||
fromAuth := args[0]
|
||||
matchField := args[2]
|
||||
|
||||
if len(fromAuth) == 0 || (fromAuth != "email" && fromAuth != "gitlab" && fromAuth != "saml") {
|
||||
if fromAuth == "" || (fromAuth != "email" && fromAuth != "gitlab" && fromAuth != "saml") {
|
||||
return errors.New("Invalid from_auth argument")
|
||||
}
|
||||
|
||||
@@ -852,7 +852,7 @@ func migrateAuthToLdapCmdF(command *cobra.Command, args []string) error {
|
||||
fromAuth = ""
|
||||
}
|
||||
|
||||
if len(matchField) == 0 || (matchField != "email" && matchField != "username") {
|
||||
if matchField == "" || (matchField != "email" && matchField != "username") {
|
||||
return errors.New("Invalid match_field argument")
|
||||
}
|
||||
|
||||
@@ -903,7 +903,7 @@ func migrateAuthToSamlCmdF(command *cobra.Command, args []string) error {
|
||||
|
||||
fromAuth := args[0]
|
||||
|
||||
if len(fromAuth) == 0 || (fromAuth != "email" && fromAuth != "gitlab" && fromAuth != "ldap") {
|
||||
if fromAuth == "" || (fromAuth != "email" && fromAuth != "gitlab" && fromAuth != "ldap") {
|
||||
return errors.New("Invalid from_auth argument")
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user