Skip to content

Commit b1c1979

Browse files
committed
debug: first propfind has sapceid, second doesn't have, let's see why
1 parent 0231168 commit b1c1979

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

internal/http/services/owncloud/ocdav/propfind.go

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,22 @@ func (s *svc) handlePathPropfind(w http.ResponseWriter, r *http.Request, ns stri
101101
}
102102

103103
func (s *svc) propfindResponse(ctx context.Context, w http.ResponseWriter, r *http.Request, namespace string, pf propfindXML, parentInfo *provider.ResourceInfo, resourceInfos []*provider.ResourceInfo, log zerolog.Logger) {
104+
log.Debug().
105+
Int("total_resourceInfos", len(resourceInfos)).
106+
Str("parent_storage_id", parentInfo.Id.StorageId).
107+
Str("parent_space_id", parentInfo.Id.SpaceId).
108+
Str("parent_opaque_id", parentInfo.Id.OpaqueId).
109+
Str("parent_path", parentInfo.Path).
110+
Msg("propfind: propfindResponse entry")
111+
for i, info := range resourceInfos {
112+
log.Debug().
113+
Int("index", i).
114+
Str("storage_id", info.Id.StorageId).
115+
Str("space_id", info.Id.SpaceId).
116+
Str("opaque_id", info.Id.OpaqueId).
117+
Str("path", info.Path).
118+
Msg("propfind: resourceInfo in propfindResponse")
119+
}
104120
user, ok := appctx.ContextGetUser(ctx)
105121
if !ok {
106122
w.WriteHeader(http.StatusUnauthorized)
@@ -268,6 +284,12 @@ func (s *svc) getResourceInfos(ctx context.Context, w http.ResponseWriter, r *ht
268284
}
269285

270286
parentInfo := res.Info
287+
log.Debug().
288+
Str("storage_id", parentInfo.Id.StorageId).
289+
Str("space_id", parentInfo.Id.SpaceId).
290+
Str("opaque_id", parentInfo.Id.OpaqueId).
291+
Str("path", parentInfo.Path).
292+
Msg("propfind: received parentInfo from Stat")
271293
resourceInfos := []*provider.ResourceInfo{parentInfo}
272294

273295
switch {
@@ -320,6 +342,16 @@ func (s *svc) getResourceInfos(ctx context.Context, w http.ResponseWriter, r *ht
320342
HandleErrorStatus(&log, w, res.Status)
321343
return nil, nil, false
322344
}
345+
log.Debug().Int("count", len(res.Infos)).Msg("propfind: received children from ListContainer")
346+
for i, info := range res.Infos {
347+
log.Debug().
348+
Int("index", i).
349+
Str("storage_id", info.Id.StorageId).
350+
Str("space_id", info.Id.SpaceId).
351+
Str("opaque_id", info.Id.OpaqueId).
352+
Str("path", info.Path).
353+
Msg("propfind: child resource from ListContainer")
354+
}
323355
resourceInfos = append(resourceInfos, res.Infos...)
324356

325357
case depth == "infinity":
@@ -436,8 +468,17 @@ func readPropfind(r io.Reader) (pf propfindXML, status int, err error) {
436468
}
437469

438470
func (s *svc) multistatusResponse(ctx context.Context, pf *propfindXML, mds []*provider.ResourceInfo, ns string, usershares, linkshares map[string]struct{}) (string, error) {
471+
log := appctx.GetLogger(ctx)
472+
log.Debug().Int("total_resources", len(mds)).Msg("propfind: building multistatus response")
439473
responses := make([]*responseXML, 0, len(mds))
440474
for i := range mds {
475+
log.Debug().
476+
Int("index", i).
477+
Str("storage_id", mds[i].Id.StorageId).
478+
Str("space_id", mds[i].Id.SpaceId).
479+
Str("opaque_id", mds[i].Id.OpaqueId).
480+
Str("path", mds[i].Path).
481+
Msg("propfind: processing resource for response")
441482
res, err := s.mdToPropResponse(ctx, pf, mds[i], ns, usershares, linkshares)
442483
if err != nil {
443484
return "", err
@@ -555,6 +596,12 @@ func (s *svc) isOpenable(path string) bool {
555596
// prefixing it with the baseURI.
556597
func (s *svc) mdToPropResponse(ctx context.Context, pf *propfindXML, md *provider.ResourceInfo, ns string, usershares, linkshares map[string]struct{}) (*responseXML, error) {
557598
sublog := appctx.GetLogger(ctx).With().Str("ns", ns).Logger()
599+
sublog.Debug().
600+
Str("storage_id", md.Id.StorageId).
601+
Str("space_id", md.Id.SpaceId).
602+
Str("opaque_id", md.Id.OpaqueId).
603+
Str("path", md.Path).
604+
Msg("propfind: mdToPropResponse entry")
558605

559606
spacesEnabled := s.c.SpacesEnabled
560607

@@ -649,6 +696,12 @@ func (s *svc) mdToPropResponse(ctx context.Context, pf *propfindXML, md *provide
649696
// return all known properties
650697
if md.Id != nil {
651698
if spacesEnabled {
699+
sublog.Debug().
700+
Str("storage_id", md.Id.StorageId).
701+
Str("space_id", md.Id.SpaceId).
702+
Str("opaque_id", md.Id.OpaqueId).
703+
Str("path", md.Path).
704+
Msg("propfind: encoding resource ID")
652705
id := spaces.EncodeResourceID(md.Id)
653706
propstatOK.Prop = append(propstatOK.Prop,
654707
s.newProp("oc:id", id),
@@ -662,6 +715,11 @@ func (s *svc) mdToPropResponse(ctx context.Context, pf *propfindXML, md *provide
662715
}
663716

664717
if md.ParentId != nil {
718+
sublog.Debug().
719+
Str("parent_storage_id", md.ParentId.StorageId).
720+
Str("parent_space_id", md.ParentId.SpaceId).
721+
Str("parent_opaque_id", md.ParentId.OpaqueId).
722+
Msg("propfind: encoding parent resource ID")
665723
id := spaces.EncodeResourceID(md.ParentId)
666724
propstatOK.Prop = append(propstatOK.Prop,
667725
s.newProp("oc:file-parent", id),

0 commit comments

Comments
 (0)