fix: quota encode json allowing zero value (#1570)

This commit is contained in:
Jian Qiu
2019-07-05 23:03:28 +08:00
committed by GitHub
parent 59a96bc444
commit b08dd390e5
3 changed files with 42 additions and 40 deletions
+3 -1
View File
@@ -116,7 +116,9 @@ func (manager *SQuotaBaseManager) queryQuota(ctx context.Context, scope rbacutil
ret.Update(quota.ToJSON(""))
ret.Update(usage.ToJSON("usage"))
ret.Update(pending.ToJSON("pending"))
if !pending.IsEmpty() {
ret.Update(pending.ToJSON("pending"))
}
if scope == rbacutils.ScopeDomain {
total, err := manager.getDomainTotalQuota(ctx, ownerId.GetProjectDomainId(), nil)