mirror of
https://github.com/OpenListTeam/OpenList.git
synced 2025-11-25 11:29:29 +08:00
fix(189): disk-usage unmarshal failed when used capacity overflow (#1577)
This commit is contained in:
@@ -200,10 +200,7 @@ func (d *Cloud189) GetDetails(ctx context.Context) (*model.StorageDetails, error
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return &model.StorageDetails{
|
return &model.StorageDetails{
|
||||||
DiskUsage: model.DiskUsage{
|
DiskUsage: driver.DiskUsageFromUsedAndTotal(capacityInfo.CloudCapacityInfo.UsedSize, capacityInfo.CloudCapacityInfo.TotalSize),
|
||||||
TotalSpace: capacityInfo.CloudCapacityInfo.TotalSize,
|
|
||||||
FreeSpace: capacityInfo.CloudCapacityInfo.FreeSize,
|
|
||||||
},
|
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -72,13 +72,13 @@ type CapacityResp struct {
|
|||||||
ResMessage string `json:"res_message"`
|
ResMessage string `json:"res_message"`
|
||||||
Account string `json:"account"`
|
Account string `json:"account"`
|
||||||
CloudCapacityInfo struct {
|
CloudCapacityInfo struct {
|
||||||
FreeSize uint64 `json:"freeSize"`
|
FreeSize int64 `json:"freeSize"`
|
||||||
MailUsedSize uint64 `json:"mail189UsedSize"`
|
MailUsedSize uint64 `json:"mail189UsedSize"`
|
||||||
TotalSize uint64 `json:"totalSize"`
|
TotalSize uint64 `json:"totalSize"`
|
||||||
UsedSize uint64 `json:"usedSize"`
|
UsedSize uint64 `json:"usedSize"`
|
||||||
} `json:"cloudCapacityInfo"`
|
} `json:"cloudCapacityInfo"`
|
||||||
FamilyCapacityInfo struct {
|
FamilyCapacityInfo struct {
|
||||||
FreeSize uint64 `json:"freeSize"`
|
FreeSize int64 `json:"freeSize"`
|
||||||
TotalSize uint64 `json:"totalSize"`
|
TotalSize uint64 `json:"totalSize"`
|
||||||
UsedSize uint64 `json:"usedSize"`
|
UsedSize uint64 `json:"usedSize"`
|
||||||
} `json:"familyCapacityInfo"`
|
} `json:"familyCapacityInfo"`
|
||||||
|
|||||||
@@ -284,18 +284,15 @@ func (y *Cloud189TV) GetDetails(ctx context.Context) (*model.StorageDetails, err
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
var total, free uint64
|
var total, used uint64
|
||||||
if y.isFamily() {
|
if y.isFamily() {
|
||||||
total = capacityInfo.FamilyCapacityInfo.TotalSize
|
total = capacityInfo.FamilyCapacityInfo.TotalSize
|
||||||
free = capacityInfo.FamilyCapacityInfo.FreeSize
|
used = capacityInfo.FamilyCapacityInfo.UsedSize
|
||||||
} else {
|
} else {
|
||||||
total = capacityInfo.CloudCapacityInfo.TotalSize
|
total = capacityInfo.CloudCapacityInfo.TotalSize
|
||||||
free = capacityInfo.CloudCapacityInfo.FreeSize
|
used = capacityInfo.CloudCapacityInfo.UsedSize
|
||||||
}
|
}
|
||||||
return &model.StorageDetails{
|
return &model.StorageDetails{
|
||||||
DiskUsage: model.DiskUsage{
|
DiskUsage: driver.DiskUsageFromUsedAndTotal(used, total),
|
||||||
TotalSpace: total,
|
|
||||||
FreeSpace: free,
|
|
||||||
},
|
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -322,13 +322,13 @@ type CapacityResp struct {
|
|||||||
ResMessage string `json:"res_message"`
|
ResMessage string `json:"res_message"`
|
||||||
Account string `json:"account"`
|
Account string `json:"account"`
|
||||||
CloudCapacityInfo struct {
|
CloudCapacityInfo struct {
|
||||||
FreeSize uint64 `json:"freeSize"`
|
FreeSize int64 `json:"freeSize"`
|
||||||
MailUsedSize uint64 `json:"mail189UsedSize"`
|
MailUsedSize uint64 `json:"mail189UsedSize"`
|
||||||
TotalSize uint64 `json:"totalSize"`
|
TotalSize uint64 `json:"totalSize"`
|
||||||
UsedSize uint64 `json:"usedSize"`
|
UsedSize uint64 `json:"usedSize"`
|
||||||
} `json:"cloudCapacityInfo"`
|
} `json:"cloudCapacityInfo"`
|
||||||
FamilyCapacityInfo struct {
|
FamilyCapacityInfo struct {
|
||||||
FreeSize uint64 `json:"freeSize"`
|
FreeSize int64 `json:"freeSize"`
|
||||||
TotalSize uint64 `json:"totalSize"`
|
TotalSize uint64 `json:"totalSize"`
|
||||||
UsedSize uint64 `json:"usedSize"`
|
UsedSize uint64 `json:"usedSize"`
|
||||||
} `json:"familyCapacityInfo"`
|
} `json:"familyCapacityInfo"`
|
||||||
|
|||||||
@@ -416,18 +416,15 @@ func (y *Cloud189PC) GetDetails(ctx context.Context) (*model.StorageDetails, err
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
var total, free uint64
|
var total, used uint64
|
||||||
if y.isFamily() {
|
if y.isFamily() {
|
||||||
total = capacityInfo.FamilyCapacityInfo.TotalSize
|
total = capacityInfo.FamilyCapacityInfo.TotalSize
|
||||||
free = capacityInfo.FamilyCapacityInfo.FreeSize
|
used = capacityInfo.FamilyCapacityInfo.UsedSize
|
||||||
} else {
|
} else {
|
||||||
total = capacityInfo.CloudCapacityInfo.TotalSize
|
total = capacityInfo.CloudCapacityInfo.TotalSize
|
||||||
free = capacityInfo.CloudCapacityInfo.FreeSize
|
used = capacityInfo.CloudCapacityInfo.UsedSize
|
||||||
}
|
}
|
||||||
return &model.StorageDetails{
|
return &model.StorageDetails{
|
||||||
DiskUsage: model.DiskUsage{
|
DiskUsage: driver.DiskUsageFromUsedAndTotal(used, total),
|
||||||
TotalSpace: total,
|
|
||||||
FreeSpace: free,
|
|
||||||
},
|
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -415,13 +415,13 @@ type CapacityResp struct {
|
|||||||
ResMessage string `json:"res_message"`
|
ResMessage string `json:"res_message"`
|
||||||
Account string `json:"account"`
|
Account string `json:"account"`
|
||||||
CloudCapacityInfo struct {
|
CloudCapacityInfo struct {
|
||||||
FreeSize uint64 `json:"freeSize"`
|
FreeSize int64 `json:"freeSize"`
|
||||||
MailUsedSize uint64 `json:"mail189UsedSize"`
|
MailUsedSize uint64 `json:"mail189UsedSize"`
|
||||||
TotalSize uint64 `json:"totalSize"`
|
TotalSize uint64 `json:"totalSize"`
|
||||||
UsedSize uint64 `json:"usedSize"`
|
UsedSize uint64 `json:"usedSize"`
|
||||||
} `json:"cloudCapacityInfo"`
|
} `json:"cloudCapacityInfo"`
|
||||||
FamilyCapacityInfo struct {
|
FamilyCapacityInfo struct {
|
||||||
FreeSize uint64 `json:"freeSize"`
|
FreeSize int64 `json:"freeSize"`
|
||||||
TotalSize uint64 `json:"totalSize"`
|
TotalSize uint64 `json:"totalSize"`
|
||||||
UsedSize uint64 `json:"usedSize"`
|
UsedSize uint64 `json:"usedSize"`
|
||||||
} `json:"familyCapacityInfo"`
|
} `json:"familyCapacityInfo"`
|
||||||
|
|||||||
Reference in New Issue
Block a user