From a9e0ecf12eceaf3d9e04497677cbd75df15f3d82 Mon Sep 17 00:00:00 2001 From: Willy Kloucek Date: Mon, 28 Mar 2022 11:51:07 +0200 Subject: [PATCH 1/3] update reva --- changelog/unreleased/update-reva.md | 1 + go.mod | 2 +- go.sum | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/changelog/unreleased/update-reva.md b/changelog/unreleased/update-reva.md index e7cc5b9885b..0edccc38565 100644 --- a/changelog/unreleased/update-reva.md +++ b/changelog/unreleased/update-reva.md @@ -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 diff --git a/go.mod b/go.mod index 3191b4b5101..fd7aae4b67a 100644 --- a/go.mod +++ b/go.mod @@ -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-20220328094822-506516e945eb 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 diff --git a/go.sum b/go.sum index af6cdc79d02..a5e5dfcbb35 100644 --- a/go.sum +++ b/go.sum @@ -340,6 +340,8 @@ 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/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= From 2b0d9aa9b0d854b66b6c3d1a9d275ddb64774cf7 Mon Sep 17 00:00:00 2001 From: David Christofas Date: Mon, 28 Mar 2022 13:00:54 +0200 Subject: [PATCH 2/3] improve quota handling in the graph API --- graph/pkg/service/v0/drives.go | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/graph/pkg/service/v0/drives.go b/graph/pkg/service/v0/drives.go index a82f284223c..63e7e47216e 100644 --- a/graph/pkg/service/v0/drives.go +++ b/graph/pkg/service/v0/drives.go @@ -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 From 19bc15e1241b45ceb9d6e280461909c713ca2ded Mon Sep 17 00:00:00 2001 From: David Christofas Date: Mon, 28 Mar 2022 14:56:18 +0200 Subject: [PATCH 3/3] include windows build fix --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index fd7aae4b67a..4763edb7f7d 100644 --- a/go.mod +++ b/go.mod @@ -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-20220328094822-506516e945eb + 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 diff --git a/go.sum b/go.sum index a5e5dfcbb35..d42ef1b5813 100644 --- a/go.sum +++ b/go.sum @@ -342,6 +342,8 @@ github.com/cs3org/reva/v2 v2.0.0-20220324071614-82800d7ef768 h1:9QNIi4oyHyv1ua8o 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=