Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix share path when listing a specific share #1918

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelog/unreleased/fix-share-path.md
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ func (h *Handler) GetShare(w http.ResponseWriter, r *http.Request) {
resourceID = psRes.Share.ResourceId
}

// var receivedShare *collaboration.ReceivedShare
if share == nil {
// check if we have a user share
logger.Debug().Str("shareID", shareID).Msg("get user share by id")
Expand Down Expand Up @@ -330,11 +331,31 @@ func (h *Handler) GetShare(w http.ResponseWriter, r *http.Request) {

if err == nil && uRes.GetShare() != nil {
resourceID = uRes.Share.ResourceId
// currentUser := ctxpkg.ContextMustGetUser(ctx)
// if utils.UserEqual(uRes.Share.Creator, currentUser.Id) {
share, err = conversions.CS3Share2ShareData(ctx, uRes.Share)
if err != nil {
response.WriteOCSError(w, r, response.MetaServerError.StatusCode, "error mapping share data", err)
return
}
// } else {
// rsRes, err := client.GetReceivedShare(ctx, &collaboration.GetReceivedShareRequest{
// Ref: &collaboration.ShareReference{
// Spec: &collaboration.ShareReference_Id{
// Id: uRes.Share.Id,
// },
// },
// })

// if err == nil && rsRes.GetShare() != nil {
// receivedShare = rsRes.GetShare()
// share, err = conversions.CS3Share2ShareData(ctx, rsRes.Share.Share)
// if err != nil {
// response.WriteOCSError(w, r, response.MetaServerError.StatusCode, "error mapping share data", err)
// return
// }
// }
// }
}
}

Expand Down Expand Up @@ -363,7 +384,11 @@ func (h *Handler) GetShare(w http.ResponseWriter, r *http.Request) {
response.WriteOCSError(w, r, response.MetaServerError.StatusCode, "error mapping share data", err)
}
h.mapUserIds(ctx, client, share)

// if receivedShare != nil && receivedShare.State == collaboration.ShareState_SHARE_STATE_ACCEPTED {
// // 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})
}

Expand Down