diff --git a/changelog/unreleased/bump-reva.md b/changelog/unreleased/bump-reva.md index a1391e763fd..b66dff3658d 100644 --- a/changelog/unreleased/bump-reva.md +++ b/changelog/unreleased/bump-reva.md @@ -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/6590 diff --git a/go.mod b/go.mod index 8170284f5ce..c9c20ac5b1c 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.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 diff --git a/go.sum b/go.sum index f034a738e47..c29b1e361b9 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.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= diff --git a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md index 110bb18097f..1f4d0e8031d 100644 --- a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md @@ -57,16 +57,6 @@ The expected failures in this file are from features in the owncloud/ocis repo. - [apiCors/cors.feature:70](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiCors/cors.feature#L70) - [apiCors/cors.feature:71](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiCors/cors.feature#L71) -#### [POST response does not return correct path when creating public link](https://github.com/owncloud/ocis/issues/5139) - -- [apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature:63](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature#L63) -- [apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature:64](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature#L64) -- [apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature:65](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature#L65) -- [apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature:93](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature#L93) -- [apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature:167](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature#L167) -- [apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature:168](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature#L168) -- [apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature:169](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature#L169) - #### [A User can get information of another user with Graph API](https://github.com/owncloud/ocis/issues/5125) - [apiGraph/getUser.feature:83](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/getUser.feature#L83) diff --git a/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature b/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature index 8330329f9b1..6a0b3efccff 100644 --- a/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature +++ b/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature @@ -151,16 +151,16 @@ Feature: Share a file or folder that is inside a space via public link | shareType | 3 | | permissions | 1 | Then the fields of the last response to user "Alice" should include - | item_type | file | - | mimetype | text/plain | - | file_target | /file.txt | - | path | folder/file.txt | - | permissions | 1 | - | share_type | public_link | - | displayname_file_owner | %displayname% | - | displayname_owner | %displayname% | - | uid_file_owner | %username% | - | uid_owner | %username% | + | item_type | file | + | mimetype | text/plain | + | file_target | /file.txt | + | path | /folder/file.txt | + | permissions | 1 | + | share_type | public_link | + | displayname_file_owner | | + | displayname_owner | %displayname% | + #| uid_file_owner | %username% | + | uid_owner | %username% | And for user "Brian" the space "share sub-item" should contain the last created public link of the file "folder/file.txt" Examples: | spaceRole | diff --git a/vendor/github.com/cs3org/reva/v2/internal/http/services/archiver/handler.go b/vendor/github.com/cs3org/reva/v2/internal/http/services/archiver/handler.go index d668ad625e8..12c58aaebab 100644 --- a/vendor/github.com/cs3org/reva/v2/internal/http/services/archiver/handler.go +++ b/vendor/github.com/cs3org/reva/v2/internal/http/services/archiver/handler.go @@ -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) diff --git a/vendor/github.com/cs3org/reva/v2/internal/http/services/archiver/manager/archiver.go b/vendor/github.com/cs3org/reva/v2/internal/http/services/archiver/manager/archiver.go index 7fdfd84c64e..8036066657b 100644 --- a/vendor/github.com/cs3org/reva/v2/internal/http/services/archiver/manager/archiver.go +++ b/vendor/github.com/cs3org/reva/v2/internal/http/services/archiver/manager/archiver.go @@ -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 { diff --git a/vendor/github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go b/vendor/github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go index 7c675f9bd41..b272c569c1c 100644 --- a/vendor/github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go +++ b/vendor/github.com/cs3org/reva/v2/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go @@ -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() diff --git a/vendor/modules.txt b/vendor/modules.txt index c1534c01986..fd6aa2741ad 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.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