diff --git a/src/client/web/src/components/panel_files.tsx b/src/client/web/src/components/panel_files.tsx index 5ff872d..a16c0fd 100644 --- a/src/client/web/src/components/panel_files.tsx +++ b/src/client/web/src/components/panel_files.tsx @@ -897,13 +897,21 @@ export class FilesPanel extends React.Component { ); const usedSpace = FileSize( - parseInt(this.props.login.extInfo.usedSpace, 10), + // TODO: this a work around before transaction is introduced + Math.trunc( + parseInt(this.props.login.extInfo.usedSpace, 10) / (1024 * 1024) + ) * + (1024 * 1024), { round: 0, } ); const spaceLimit = FileSize( - parseInt(this.props.login.quota.spaceLimit, 10), + // TODO: this a work around before transaction is introduced + Math.trunc( + parseInt(this.props.login.quota.spaceLimit, 10) / (1024 * 1024) + ) * + (1024 * 1024), { round: 0, } diff --git a/src/db/userstore/user_store.go b/src/db/userstore/user_store.go index 8a347f1..3a9cc51 100644 --- a/src/db/userstore/user_store.go +++ b/src/db/userstore/user_store.go @@ -381,6 +381,9 @@ func (us *KVUserStore) SetUsed(id uint64, incr bool, capacity int64) error { gotUser.UsedSpace = gotUser.UsedSpace + capacity } else { gotUser.UsedSpace = gotUser.UsedSpace - capacity + if gotUser.UsedSpace < 0 { // TODO: this is a work around + gotUser.UsedSpace = 0 + } } infoBytes, err := json.Marshal(gotUser) if err != nil {