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

Allow full paths targets #1605

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 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
6 changes: 6 additions & 0 deletions changelog/unreleased/fix-sharing-paths.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Bugfix: Allow to expose full paths in OCS API

Before this fix a share file_target was always harcoded to use a base path.
This fix provides the possiblity to expose full paths in the OCIS API and asymptotically in OCIS web.

https://github.com/cs3org/reva/pull/1605
Original file line number Diff line number Diff line change
Expand Up @@ -638,17 +638,16 @@ func (h *Handler) listSharesWithMe(w http.ResponseWriter, r *http.Request) {
response.WriteOCSError(w, r, response.MetaServerError.StatusCode, "grpc ListReceivedShares request failed", err)
return
}
lrsRes.GetShares()

shares := make([]*conversions.ShareData, 0)

var info *provider.ResourceInfo
// TODO(refs) filter out "invalid" shares
for _, rs := range lrsRes.GetShares() {

if stateFilter != ocsStateUnknown && rs.GetState() != stateFilter {
continue
}

if pinfo != nil {
// check if the shared resource matches the path resource
if rs.Share.ResourceId.StorageId != pinfo.GetId().StorageId ||
Expand Down Expand Up @@ -702,11 +701,12 @@ func (h *Handler) listSharesWithMe(w http.ResponseWriter, r *http.Request) {

if data.State == ocsStateAccepted {
// Needed because received shares can be jailed in a folder in the users home
data.FileTarget = path.Join(h.sharePrefix, path.Base(info.Path))
data.Path = path.Join(h.sharePrefix, path.Base(info.Path))
data.FileTarget = path.Join(h.sharePrefix, info.Path)
labkode marked this conversation as resolved.
Show resolved Hide resolved
data.Path = path.Join(h.sharePrefix, info.Path)
}

shares = append(shares, data)
log.Debug().Msgf("listSharesWithMe: %+v", *data)
labkode marked this conversation as resolved.
Show resolved Hide resolved
}

response.WriteOCSSuccess(w, r, shares)
Expand Down Expand Up @@ -845,7 +845,7 @@ func (h *Handler) addFileInfo(ctx context.Context, s *conversions.ShareData, inf
s.ItemSource = wrapResourceID(info.Id)
s.FileSource = s.ItemSource
s.FileTarget = path.Join("/", path.Base(info.Path))
s.Path = path.Join("/", path.Base(info.Path)) // TODO hm this might have to be relative to the users home ... depends on the webdav_namespace config
s.Path = path.Join("/", info.Path) // TODO hm this might have to be relative to the users home ... depends on the webdav_namespace config
// TODO FileParent:
// item type
s.ItemType = conversions.ResourceType(info.GetType()).String()
Expand Down