Skip to content

Commit

Permalink
Separate PROPFIND logic for Depth 1 and infinity (#779)
Browse files Browse the repository at this point in the history
Switching to path concatenation broke some cross-storage cases.
Since clients currently only use Depth 1, here we make sure that at
least this works.
For the infinity case, it is limited to single storage recursion for
now.
  • Loading branch information
Vincent Petry authored May 28, 2020
1 parent a384685 commit d0d7449
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion internal/http/services/owncloud/ocdav/propfind.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,25 @@ func (s *svc) handlePropfind(w http.ResponseWriter, r *http.Request, ns string)

info := res.Info
infos := []*provider.ResourceInfo{info}
if info.Type == provider.ResourceType_RESOURCE_TYPE_CONTAINER && depth != "0" {
if info.Type == provider.ResourceType_RESOURCE_TYPE_CONTAINER && depth == "1" {
req := &provider.ListContainerRequest{
Ref: ref,
}
res, err := client.ListContainer(ctx, req)
if err != nil {
log.Error().Err(err).Msg("error sending list container grpc request")
w.WriteHeader(http.StatusInternalServerError)
return
}

if res.Status.Code != rpc.Code_CODE_OK {
log.Err(err).Msg("error calling grpc list container")
w.WriteHeader(http.StatusInternalServerError)
return
}
infos = append(infos, res.Infos...)
} else if depth == "infinity" {
// FIXME: doesn't work cross-storage as the results will have the wrong paths!
// use a stack to explore sub-containers breadth-first
stack := []string{info.Path}
for len(stack) > 0 {
Expand Down

0 comments on commit d0d7449

Please sign in to comment.