From 22b7b8f45b5e2d94a62d8f221462c5829d46e5a9 Mon Sep 17 00:00:00 2001 From: David Christofas Date: Fri, 23 Jul 2021 16:27:27 +0200 Subject: [PATCH] fix share path when listing a specific share --- changelog/unreleased/fix-share-path.md | 5 +++ .../handlers/apps/sharing/shares/shares.go | 5 +++ .../apiShareUpdate-updateShare.feature | 38 ------------------- 3 files changed, 10 insertions(+), 38 deletions(-) create mode 100644 changelog/unreleased/fix-share-path.md diff --git a/changelog/unreleased/fix-share-path.md b/changelog/unreleased/fix-share-path.md new file mode 100644 index 00000000000..71130343faa --- /dev/null +++ b/changelog/unreleased/fix-share-path.md @@ -0,0 +1,5 @@ +Bugfix: Fix share path when listing a specific share + +The file path and target of shares where missing the share jail path when a specific share was listed. + +https://github.com/cs3org/reva/pull/1918 diff --git a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go index 624df6bcf96..5ccf9e78003 100644 --- a/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go +++ b/internal/http/services/owncloud/ocs/handlers/apps/sharing/shares/shares.go @@ -438,6 +438,11 @@ func (h *Handler) getShare(w http.ResponseWriter, r *http.Request, shareID strin response.WriteOCSError(w, r, response.MetaServerError.StatusCode, "error mapping share data", err) } h.mapUserIds(ctx, client, share) + if share.State == ocsStateAccepted && share.ShareType != conversions.ShareTypePublicLink { + // Needed because received shares can be jailed in a folder in the users home + share.FileTarget = path.Join(h.sharePrefix, path.Base(info.Path)) + share.Path = path.Join(h.sharePrefix, path.Base(info.Path)) + } response.WriteOCSSuccess(w, r, []*conversions.ShareData{share}) } diff --git a/tests/acceptance/features/apiOcisSpecific/apiShareUpdate-updateShare.feature b/tests/acceptance/features/apiOcisSpecific/apiShareUpdate-updateShare.feature index 32d0056d98d..18f67479715 100644 --- a/tests/acceptance/features/apiOcisSpecific/apiShareUpdate-updateShare.feature +++ b/tests/acceptance/features/apiOcisSpecific/apiShareUpdate-updateShare.feature @@ -5,44 +5,6 @@ Feature: sharing Given using OCS API version "1" And user "Alice" has been created with default attributes and without skeleton files - @skipOnOcis-EOS-Storage @toFixOnOCIS @issue-ocis-reva-243 @skipOnOcis-OCIS-Storage - # after fixing all issues delete this Scenario and use the one from oC10 core - Scenario: Share ownership change after moving a shared file to another share - Given these users have been created with default attributes and without skeleton files: - | username | - | Brian | - | Carol | - And user "Alice" has created folder "/Alice-folder" - And user "Alice" has created folder "/Alice-folder/folder2" - And user "Carol" has created folder "/Carol-folder" - And user "Alice" has shared folder "/Alice-folder" with user "Brian" with permissions "all" - And user "Carol" has shared folder "/Carol-folder" with user "Brian" with permissions "all" - When user "Brian" moves folder "/Alice-folder/folder2" to "/Carol-folder/folder2" using the WebDAV API - And user "Carol" gets the info of the last share using the sharing API - # Note: in the following fields, file_parent has been removed because OCIS does not report that - Then the fields of the last response to user "Carol" sharing with user "Brian" should include - | id | A_STRING | - | item_type | folder | - | item_source | A_STRING | - | share_type | user | - | file_source | A_STRING | - | file_target | /Carol-folder | - | permissions | all | - | stime | A_NUMBER | - | storage | A_STRING | - | mail_send | 0 | - | uid_owner | %username% | - | displayname_owner | %displayname% | - | mimetype | httpd/unix-directory | - # Really folder2 should be gone from Alice-folder and be found in Carol-folder - # like in these 2 suggested steps: - # And as "Alice" folder "/Alice-folder/folder2" should not exist - # And as "Carol" folder "/Carol-folder/folder2" should exist - # - # But this happens on OCIS: - And as "Alice" folder "/Alice-folder/folder2" should exist - And as "Carol" folder "/Carol-folder/folder2" should not exist - @skipOnOcis-OC-Storage @toFixOnOCIS @issue-ocis-reva-243 @skipOnOcis-OCIS-Storage # same as oC10 core Scenario but without displayname_owner because EOS does not report it # after fixing all issues delete this Scenario and use the one from oC10 core