mirror of
https://github.com/OpenListTeam/OpenList.git
synced 2025-11-25 03:15:19 +08:00
fix(drivers): free space underflow if used larger than total space (#1407)
This commit is contained in:
@@ -61,6 +61,13 @@ type DiskUsage struct {
|
||||
FreeSpace uint64 `json:"free_space"`
|
||||
}
|
||||
|
||||
func NewDiskUsageFromUsedAndTotal(used, total uint64) *DiskUsage {
|
||||
return &DiskUsage{
|
||||
TotalSpace: max(used, total),
|
||||
FreeSpace: total - min(used, total),
|
||||
}
|
||||
}
|
||||
|
||||
type StorageDetails struct {
|
||||
DiskUsage
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user