diff --git a/go.mod b/go.mod index 6797608c7b8..535819180c6 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/coreos/go-oidc v2.2.1+incompatible github.com/coreos/go-oidc/v3 v3.6.0 github.com/cs3org/go-cs3apis v0.0.0-20230516150832-730ac860c71d - github.com/cs3org/reva/v2 v2.14.1-0.20230711102918-b095db01ac36 + github.com/cs3org/reva/v2 v2.14.1-0.20230712131605-76f38842c6d2 github.com/disintegration/imaging v1.6.2 github.com/dutchcoders/go-clamd v0.0.0-20170520113014-b970184f4d9e github.com/egirna/icap-client v0.1.1 diff --git a/go.sum b/go.sum index 5c80c155007..aebb344b424 100644 --- a/go.sum +++ b/go.sum @@ -625,8 +625,8 @@ github.com/crewjam/httperr v0.2.0 h1:b2BfXR8U3AlIHwNeFFvZ+BV1LFvKLlzMjzaTnZMybNo github.com/crewjam/httperr v0.2.0/go.mod h1:Jlz+Sg/XqBQhyMjdDiC+GNNRzZTD7x39Gu3pglZ5oH4= github.com/crewjam/saml v0.4.13 h1:TYHggH/hwP7eArqiXSJUvtOPNzQDyQ7vwmwEqlFWhMc= github.com/crewjam/saml v0.4.13/go.mod h1:igEejV+fihTIlHXYP8zOec3V5A8y3lws5bQBFsTm4gA= -github.com/cs3org/reva/v2 v2.14.1-0.20230711102918-b095db01ac36 h1:Jww+ia7QQPE6zctpRb60iflrAaasRxNl9AfmOyM8Fw0= -github.com/cs3org/reva/v2 v2.14.1-0.20230711102918-b095db01ac36/go.mod h1:4z5EQghS2LhSWZWocH51Dw9VAs16No1zSFvFgQtgS7w= +github.com/cs3org/reva/v2 v2.14.1-0.20230712131605-76f38842c6d2 h1:i9hn9nmcLLezXh4Dt9aa867CtCXQhNujEWTL+4+M3S4= +github.com/cs3org/reva/v2 v2.14.1-0.20230712131605-76f38842c6d2/go.mod h1:4z5EQghS2LhSWZWocH51Dw9VAs16No1zSFvFgQtgS7w= 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= diff --git a/vendor/github.com/cs3org/reva/v2/internal/grpc/services/publicshareprovider/publicshareprovider.go b/vendor/github.com/cs3org/reva/v2/internal/grpc/services/publicshareprovider/publicshareprovider.go index 7f7e3016628..e8f18aea6c5 100644 --- a/vendor/github.com/cs3org/reva/v2/internal/grpc/services/publicshareprovider/publicshareprovider.go +++ b/vendor/github.com/cs3org/reva/v2/internal/grpc/services/publicshareprovider/publicshareprovider.go @@ -22,6 +22,7 @@ import ( "context" "regexp" + rpc "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1" link "github.com/cs3org/go-cs3apis/cs3/sharing/link/v1beta1" "github.com/cs3org/reva/v2/pkg/appctx" ctxpkg "github.com/cs3org/reva/v2/pkg/ctx" @@ -218,15 +219,29 @@ func (s *service) GetPublicShare(ctx context.Context, req *link.GetPublicShareRe log.Error().Msg("error getting user from context") } - found, err := s.sm.GetPublicShare(ctx, u, req.Ref, req.GetSign()) - if err != nil { - return nil, err + ps, err := s.sm.GetPublicShare(ctx, u, req.Ref, req.GetSign()) + switch { + case err != nil: + var st *rpc.Status + switch err.(type) { + case errtypes.IsNotFound: + st = status.NewNotFound(ctx, err.Error()) + default: + st = status.NewInternal(ctx, err.Error()) + } + return &link.GetPublicShareResponse{ + Status: st, + }, nil + case ps == nil: + return &link.GetPublicShareResponse{ + Status: status.NewNotFound(ctx, "not found"), + }, nil + default: + return &link.GetPublicShareResponse{ + Status: status.NewOK(ctx), + Share: ps, + }, nil } - - return &link.GetPublicShareResponse{ - Status: status.NewOK(ctx), - Share: found, - }, nil } func (s *service) ListPublicShares(ctx context.Context, req *link.ListPublicSharesRequest) (*link.ListPublicSharesResponse, error) { diff --git a/vendor/github.com/cs3org/reva/v2/pkg/publicshare/manager/json/json.go b/vendor/github.com/cs3org/reva/v2/pkg/publicshare/manager/json/json.go index bad4767ec33..5d7673b8244 100644 --- a/vendor/github.com/cs3org/reva/v2/pkg/publicshare/manager/json/json.go +++ b/vendor/github.com/cs3org/reva/v2/pkg/publicshare/manager/json/json.go @@ -430,7 +430,7 @@ func (m *manager) GetPublicShare(ctx context.Context, u *user.User, ref *link.Pu if ref.GetToken() != "" { ps, pw, err := m.getByToken(ctx, ref.GetToken()) if err != nil { - return nil, errors.New("no shares found by token") + return nil, errtypes.NotFound("no shares found by token") } if ps.PasswordProtected && sign { err := publicshare.AddSignature(ps, pw) @@ -463,7 +463,7 @@ func (m *manager) GetPublicShare(ctx context.Context, u *user.User, ref *link.Pu if err := m.revokeExpiredPublicShare(ctx, &ps, u); err != nil { return nil, err } - return nil, errors.New("no shares found by id:" + ref.GetId().String()) + return nil, errtypes.NotFound("no shares found by id:" + ref.GetId().String()) } if ps.PasswordProtected && sign { err := publicshare.AddSignature(&ps, passDB) @@ -475,7 +475,7 @@ func (m *manager) GetPublicShare(ctx context.Context, u *user.User, ref *link.Pu } } - return nil, errors.New("no shares found by id:" + ref.GetId().String()) + return nil, errtypes.NotFound("no shares found by id:" + ref.GetId().String()) } // ListPublicShares retrieves all the shares on the manager that are valid. diff --git a/vendor/github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/migrator/0005_fix_messagepack_space_index_format.go b/vendor/github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/migrator/0005_fix_messagepack_space_index_format.go new file mode 100644 index 00000000000..ca69fd869cf --- /dev/null +++ b/vendor/github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/migrator/0005_fix_messagepack_space_index_format.go @@ -0,0 +1,68 @@ +// Copyright 2018-2023 CERN +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// In applying this license, CERN does not waive the privileges and immunities +// granted to it by virtue of its status as an Intergovernmental Organization +// or submit itself to any jurisdiction. + +package migrator + +import ( + "os" + "path/filepath" + + "github.com/shamaton/msgpack/v2" +) + +// Migration0005 fixes the messagepack space index data structure +func (m *Migrator) Migration0005() (Result, error) { + root := m.lu.InternalRoot() + + indexes, err := filepath.Glob(filepath.Join(root, "indexes", "**", "*.mpk")) + if err != nil { + return resultFailed, err + } + for _, i := range indexes { + m.log.Info().Str("root", m.lu.InternalRoot()).Msg("Fixing index format of " + i) + + // Read old-format index + oldData, err := os.ReadFile(i) + if err != nil { + return resultFailed, err + } + oldIndex := map[string][]byte{} + err = msgpack.Unmarshal(oldData, &oldIndex) + if err != nil { + // likely already migrated -> skip + m.log.Warn().Str("root", m.lu.InternalRoot()).Msg("Invalid index format found in " + i) + continue + } + + // Write new-format index + newIndex := map[string]string{} + for k, v := range oldIndex { + newIndex[k] = string(v) + } + newData, err := msgpack.Marshal(newIndex) + if err != nil { + return resultFailed, err + } + err = os.WriteFile(i, newData, 0600) + if err != nil { + return resultFailed, err + } + } + m.log.Info().Msg("done.") + return resultSucceeded, nil +} diff --git a/vendor/github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/migrator/migrator.go b/vendor/github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/migrator/migrator.go index 13b5c91da80..17001e80247 100644 --- a/vendor/github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/migrator/migrator.go +++ b/vendor/github.com/cs3org/reva/v2/pkg/storage/utils/decomposedfs/migrator/migrator.go @@ -29,7 +29,7 @@ import ( "github.com/rs/zerolog" ) -var allMigrations = []string{"0001", "0002", "0003", "0004"} +var allMigrations = []string{"0001", "0002", "0003", "0004", "0005"} const ( resultFailed = "failed" diff --git a/vendor/modules.txt b/vendor/modules.txt index a317cd1fe17..c2d5a95cac2 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -352,7 +352,7 @@ github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1 github.com/cs3org/go-cs3apis/cs3/storage/registry/v1beta1 github.com/cs3org/go-cs3apis/cs3/tx/v1beta1 github.com/cs3org/go-cs3apis/cs3/types/v1beta1 -# github.com/cs3org/reva/v2 v2.14.1-0.20230711102918-b095db01ac36 +# github.com/cs3org/reva/v2 v2.14.1-0.20230712131605-76f38842c6d2 ## explicit; go 1.20 github.com/cs3org/reva/v2/cmd/revad/internal/grace github.com/cs3org/reva/v2/cmd/revad/runtime