Skip to content

Commit

Permalink
Merge pull request #3405 from owncloud/update-reva-28-3-2022
Browse files Browse the repository at this point in the history
[full-ci] update reva
  • Loading branch information
wkloucek committed Mar 28, 2022
2 parents bc15db1 + 7ecb7cc commit 8d13e11
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
1 change: 1 addition & 0 deletions changelog/unreleased/update-reva.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ Updated reva to version XXXX. This update includes:
* Enh [cs3org/reva#2628](https://github.com/cs3org/reva/pull/2628): Webdav trash-bin API for spaces

https://github.com/owncloud/ocis/pull/3330
https://github.com/owncloud/ocis/pull/3405
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ require (
github.com/blevesearch/bleve/v2 v2.3.2
github.com/coreos/go-oidc/v3 v3.1.0
github.com/cs3org/go-cs3apis v0.0.0-20220126114148-64c025ccdd19
github.com/cs3org/reva/v2 v2.0.0-20220324071614-82800d7ef768
github.com/cs3org/reva/v2 v2.0.0-20220328125240-96279f215b6e
github.com/disintegration/imaging v1.6.2
github.com/glauth/glauth/v2 v2.0.0-20211021011345-ef3151c28733
github.com/go-chi/chi/v5 v5.0.7
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,10 @@ github.com/cs3org/go-cs3apis v0.0.0-20220126114148-64c025ccdd19 h1:1jqPH58jCxvba
github.com/cs3org/go-cs3apis v0.0.0-20220126114148-64c025ccdd19/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY=
github.com/cs3org/reva/v2 v2.0.0-20220324071614-82800d7ef768 h1:9QNIi4oyHyv1ua8oPyeBdLcMU6hKDyNmGuSxWmf01BM=
github.com/cs3org/reva/v2 v2.0.0-20220324071614-82800d7ef768/go.mod h1:kFqm3iwrRHyEnP606H+wSWmJzjk0nj2kPShsowriqxg=
github.com/cs3org/reva/v2 v2.0.0-20220328094822-506516e945eb h1:cAj77j0jVtZlrTUue8pT/wFDKrt0oEppLHg+0QkD6gQ=
github.com/cs3org/reva/v2 v2.0.0-20220328094822-506516e945eb/go.mod h1:kFqm3iwrRHyEnP606H+wSWmJzjk0nj2kPShsowriqxg=
github.com/cs3org/reva/v2 v2.0.0-20220328125240-96279f215b6e h1:ciwo9RflVAQmgkIhhtuwJdfSKIrqg9fdj/lWJ53fm/k=
github.com/cs3org/reva/v2 v2.0.0-20220328125240-96279f215b6e/go.mod h1:kFqm3iwrRHyEnP606H+wSWmJzjk0nj2kPShsowriqxg=
github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8 h1:Z9lwXumT5ACSmJ7WGnFl+OMLLjpz5uR2fyz7dC255FI=
github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8/go.mod h1:4abs/jPXcmJzYoYGF91JF9Uq9s/KL5n1jvFDix8KcqY=
github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4=
Expand Down
24 changes: 20 additions & 4 deletions graph/pkg/service/v0/drives.go
Original file line number Diff line number Diff line change
Expand Up @@ -584,16 +584,32 @@ func (g Graph) getDriveQuota(ctx context.Context, space *storageprovider.Storage
return nil, err
}

total := int64(res.TotalBytes)
var remaining int64
if res.Opaque != nil {
m := res.Opaque.Map
if e, ok := m["remaining"]; ok {
remaining, _ = strconv.ParseInt(string(e.Value), 10, 64)
}
}

used := int64(res.UsedBytes)
remaining := total - used
qta := libregraph.Quota{
Remaining: &remaining,
Total: &total,
Used: &used,
}
state := calculateQuotaState(total, used)

var t int64
if total := int64(res.TotalBytes); total != 0 {

// A quota was set
qta.Total = &total
t = total
} else {
// Quota was not set
// Use remaining bytes to calculate state
t = remaining
}
state := calculateQuotaState(t, used)
qta.State = &state

return &qta, nil
Expand Down

0 comments on commit 8d13e11

Please sign in to comment.