fix(region): avoid panic when change-owner missing domain_id (#19472)

This commit is contained in:
屈轩
2024-02-08 10:51:26 +08:00
committed by GitHub
parent 31bade24e7
commit 52404a26d9
+4
View File
@@ -20,6 +20,7 @@ import (
"yunion.io/x/jsonutils"
"yunion.io/x/log"
"yunion.io/x/pkg/errors"
"yunion.io/x/pkg/gotypes"
"yunion.io/x/pkg/utils"
"yunion.io/x/sqlchemy"
@@ -125,6 +126,9 @@ func (model *SDomainLevelResourceBase) PerformChangeOwner(ctx context.Context, u
if err != nil {
return nil, httperrors.NewGeneralError(err)
}
if gotypes.IsNil(ownerId) {
return nil, httperrors.NewMissingParameterError("domain_id")
}
if len(ownerId.GetProjectDomainId()) == 0 {
return nil, httperrors.NewInputParameterError("missing new domain")
}