Skip to content

Commit

Permalink
fix response after deleting a share
Browse files Browse the repository at this point in the history
Added the deleted share to the response after deleting it.
  • Loading branch information
David Christofas committed Sep 8, 2021
1 parent f004c26 commit 4c47804
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 17 deletions.
5 changes: 5 additions & 0 deletions changelog/unreleased/delete-share-response.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: Fix the response after deleting a share

Added the deleted share to the response after deleting it.

https://github.com/cs3org/reva/pull/2054
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,34 @@ func (h *Handler) removeUserShare(w http.ResponseWriter, r *http.Request, shareI
return
}

uReq := &collaboration.RemoveShareRequest{
Ref: &collaboration.ShareReference{
Spec: &collaboration.ShareReference_Id{
Id: &collaboration.ShareId{
OpaqueId: shareID,
},
shareRef := &collaboration.ShareReference{
Spec: &collaboration.ShareReference_Id{
Id: &collaboration.ShareId{
OpaqueId: shareID,
},
},
}
getShareResp, err := uClient.GetShare(ctx, &collaboration.GetShareRequest{Ref: shareRef})
if err != nil {
response.WriteOCSError(w, r, response.MetaServerError.StatusCode, "error sending a grpc delete share request", err)
return
} else if getShareResp.Status.Code != rpc.Code_CODE_OK {
if getShareResp.Status.Code == rpc.Code_CODE_NOT_FOUND {
response.WriteOCSError(w, r, response.MetaNotFound.StatusCode, "not found", nil)
return
}
response.WriteOCSError(w, r, response.MetaServerError.StatusCode, "deleting share failed", err)
return
}

data, err := conversions.CS3Share2ShareData(ctx, getShareResp.Share)
if err != nil {
response.WriteOCSError(w, r, response.MetaServerError.StatusCode, "deleting share failed", err)
return
}
data.ID = ""

uReq := &collaboration.RemoveShareRequest{Ref: shareRef}
uRes, err := uClient.RemoveShare(ctx, uReq)
if err != nil {
response.WriteOCSError(w, r, response.MetaServerError.StatusCode, "error sending a grpc delete share request", err)
Expand All @@ -117,7 +136,7 @@ func (h *Handler) removeUserShare(w http.ResponseWriter, r *http.Request, shareI
response.WriteOCSError(w, r, response.MetaServerError.StatusCode, "grpc delete share request failed", err)
return
}
response.WriteOCSSuccess(w, r, nil)
response.WriteOCSSuccess(w, r, data)
}

func (h *Handler) listUserShares(r *http.Request, filters []*collaboration.Filter) ([]*conversions.ShareData, *rpc.Status, error) {
Expand Down
5 changes: 0 additions & 5 deletions tests/acceptance/expected-failures-on-OCIS-storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -349,11 +349,6 @@ The first two tests work against ocis. There must be something wrong in the CI s
#### [Cannot move a file to a shared folder](https://github.com/owncloud/ocis/issues/2146)
- [apiShareManagementBasicToShares/createShareToSharesFolder.feature:515](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareManagementBasicToShares/createShareToSharesFolder.feature#L515)

#### [deleting share response does not contain `data` field](https://github.com/owncloud/ocis/issues/721)

- [apiShareManagementBasicToShares/deleteShareFromShares.feature:43](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareManagementBasicToShares/deleteShareFromShares.feature#L43)
- [apiShareManagementBasicToShares/deleteShareFromShares.feature:44](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareManagementBasicToShares/deleteShareFromShares.feature#L44)

#### [sharing via API and changing the cases in the username does not work correctly](https://github.com/owncloud/core/issues/35484)
- [apiShareManagementBasicToShares/createShareToSharesFolder.feature:373](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareManagementBasicToShares/createShareToSharesFolder.feature#L373)

Expand Down
5 changes: 0 additions & 5 deletions tests/acceptance/expected-failures-on-S3NG-storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,6 @@ File and sync features in a shared scenario
#### [Cannot move a file to a shared folder](https://github.com/owncloud/ocis/issues/2146)
- [apiShareManagementBasicToShares/createShareToSharesFolder.feature:515](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareManagementBasicToShares/createShareToSharesFolder.feature#L515)

#### [deleting share response does not contain `data` field](https://github.com/owncloud/ocis/issues/721)

- [apiShareManagementBasicToShares/deleteShareFromShares.feature:43](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareManagementBasicToShares/deleteShareFromShares.feature#L43)
- [apiShareManagementBasicToShares/deleteShareFromShares.feature:44](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareManagementBasicToShares/deleteShareFromShares.feature#L44)

#### [path property in pending shares gives only filename](https://github.com/owncloud/ocis/issues/2156)
- [apiShareManagementBasicToShares/createShareToSharesFolder.feature:373](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareManagementBasicToShares/createShareToSharesFolder.feature#L373)
- [apiShareManagementBasicToShares/createShareToSharesFolder.feature:543](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiShareManagementBasicToShares/createShareToSharesFolder.feature#L543)
Expand Down

0 comments on commit 4c47804

Please sign in to comment.