bump reva

Signed-off-by: jkoberg <jkoberg@owncloud.com>
This commit is contained in:
jkoberg
2023-06-22 10:10:37 +02:00
parent a64dd835e7
commit 098d51bf0e
7 changed files with 39 additions and 13 deletions

View File

@@ -28,3 +28,4 @@ https://github.com/owncloud/ocis/pull/6529
https://github.com/owncloud/ocis/pull/6544
https://github.com/owncloud/ocis/pull/6507
https://github.com/owncloud/ocis/pull/6572
https://github.com/owncloud/ocis/pull/6589

2
go.mod
View File

@@ -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.20230621095551-a4c97189e11a
github.com/cs3org/reva/v2 v2.14.1-0.20230623085734-919a9585f147
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

4
go.sum
View File

@@ -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.20230621095551-a4c97189e11a h1:MKQ3H+hxw7geL2ih7wdhIF/YGFY2F1Bl8HBt6WTTkwk=
github.com/cs3org/reva/v2 v2.14.1-0.20230621095551-a4c97189e11a/go.mod h1:E32krZG159YflDSjDWfx/QGIC2529PS5LiPnGNHu3d0=
github.com/cs3org/reva/v2 v2.14.1-0.20230623085734-919a9585f147 h1:2NXX7yxaUNRQ9k8JRFOoyrvWhV/NG0RLd5QsWqxy3R0=
github.com/cs3org/reva/v2 v2.14.1-0.20230623085734-919a9585f147/go.mod h1:E32krZG159YflDSjDWfx/QGIC2529PS5LiPnGNHu3d0=
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=

View File

@@ -263,11 +263,13 @@ func (s *svc) Handler() http.Handler {
rw.Header().Set("Content-Transfer-Encoding", "binary")
// create the archive
var closeArchive func()
if userAgent.OS == ua.Windows {
err = arch.CreateZip(ctx, rw)
closeArchive, err = arch.CreateZip(ctx, rw)
} else {
err = arch.CreateTar(ctx, rw)
closeArchive, err = arch.CreateTar(ctx, rw)
}
defer closeArchive()
if err != nil {
s.writeHTTPError(rw, err)

View File

@@ -61,8 +61,11 @@ func NewArchiver(r []*provider.ResourceId, w walker.Walker, d downloader.Downloa
}
// CreateTar creates a tar and write it into the dst Writer
func (a *Archiver) CreateTar(ctx context.Context, dst io.Writer) error {
func (a *Archiver) CreateTar(ctx context.Context, dst io.Writer) (func(), error) {
w := tar.NewWriter(dst)
closer := func() {
_ = w.Close()
}
var filesCount, sizeFiles int64
@@ -125,16 +128,19 @@ func (a *Archiver) CreateTar(ctx context.Context, dst io.Writer) error {
})
if err != nil {
return err
return closer, err
}
}
return w.Close()
return closer, nil
}
// CreateZip creates a zip and write it into the dst Writer
func (a *Archiver) CreateZip(ctx context.Context, dst io.Writer) error {
func (a *Archiver) CreateZip(ctx context.Context, dst io.Writer) (func(), error) {
w := zip.NewWriter(dst)
closer := func() {
_ = w.Close()
}
var filesCount, sizeFiles int64
@@ -193,11 +199,11 @@ func (a *Archiver) CreateZip(ctx context.Context, dst io.Writer) error {
})
if err != nil {
return err
return closer, err
}
}
return w.Close()
return closer, nil
}
func isSpaceRoot(info *provider.ResourceInfo) bool {

View File

@@ -308,7 +308,8 @@ func (h *Handler) CreateShare(w http.ResponseWriter, r *http.Request) {
}
s := conversions.PublicShare2ShareData(share, r, h.publicURL)
h.addFileInfo(ctx, s, statRes.Info)
h.addFileInfo(ctx, s, statRes.GetInfo())
h.addPath(ctx, s, statRes.GetInfo())
h.mapUserIds(ctx, client, s)
response.WriteOCSSuccess(w, r, s)
@@ -1225,6 +1226,22 @@ func (h *Handler) addFileInfo(ctx context.Context, s *conversions.ShareData, inf
s.SpaceAlias = utils.ReadPlainFromOpaque(info.GetSpace().GetOpaque(), "spaceAlias")
}
// addPath adds the complete path of the `ResourceInfo` to the `ShareData`. It is an expensive operation and might leak data so use it with care.
func (h *Handler) addPath(ctx context.Context, s *conversions.ShareData, info *provider.ResourceInfo) {
log := appctx.GetLogger(ctx)
client, err := h.getClient()
if err != nil {
log.Error().Err(err).Msg("addPath failed: cannot get gateway client")
return
}
gpRes, err := client.GetPath(ctx, &provider.GetPathRequest{ResourceId: info.Id})
if err != nil || gpRes.GetStatus().GetCode() != rpc.Code_CODE_OK {
log.Error().Err(err).Interface("rpc response code", gpRes.GetStatus().GetCode()).Msg("addPath failed: cannot get path")
return
}
s.Path = gpRes.GetPath()
}
// mustGetIdentifiers always returns a struct with identifiers, if the user or group could not be found they will all be empty
func (h *Handler) mustGetIdentifiers(ctx context.Context, client gateway.GatewayAPIClient, id string, isGroup bool) *userIdentifiers {
sublog := appctx.GetLogger(ctx).With().Str("id", id).Logger()

2
vendor/modules.txt vendored
View File

@@ -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.20230621095551-a4c97189e11a
# github.com/cs3org/reva/v2 v2.14.1-0.20230623085734-919a9585f147
## explicit; go 1.20
github.com/cs3org/reva/v2/cmd/revad/internal/grace
github.com/cs3org/reva/v2/cmd/revad/runtime