Skip to content

Commit

Permalink
Merge pull request #3841 from micbar/improve-logging
Browse files Browse the repository at this point in the history
fix nil pointer and improve logging
  • Loading branch information
micbar committed May 2, 2023
2 parents 7d29aef + 6be420d commit 62f956f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
5 changes: 5 additions & 0 deletions changelog/unreleased/fix-nil-pointer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: Fix nil pointer and improve logging

We fixed a nil pointer error due to a wrong log statement and improved the logging in the json public share manager.

https://github.com/cs3org/reva/pull/3841
2 changes: 1 addition & 1 deletion internal/grpc/services/storageprovider/storageprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ func (s *service) Stat(ctx context.Context, req *provider.StatRequest) (*provide

span.SetAttributes(attribute.KeyValue{
Key: "reference",
Value: attribute.StringValue(req.Ref.String()),
Value: attribute.StringValue(req.GetRef().String()),
})

md, err := s.storage.GetMD(ctx, req.GetRef(), req.GetArbitraryMetadataKeys(), req.GetFieldMask().GetPaths())
Expand Down
12 changes: 10 additions & 2 deletions pkg/publicshare/manager/json/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -523,12 +523,20 @@ func (m *manager) ListPublicShares(ctx context.Context, u *user.User, filters []
log.Error().
Err(err).
Interface("resource_id", local.ResourceId).
Msg("ListShares: could not stat resource")
Msg("ListShares: an error occurred during stat on the resource")
continue
}
if sRes.Status.Code != rpc.Code_CODE_OK {
if sRes.Status.Code == rpc.Code_CODE_NOT_FOUND {
log.Debug().
Str("message", sRes.Status.Message).
Interface("status", sRes.Status).
Interface("resource_id", local.ResourceId).
Msg("ListShares: Resource not found")
continue
}
log.Error().
Err(err).
Str("message", sRes.Status.Message).
Interface("status", sRes.Status).
Interface("resource_id", local.ResourceId).
Msg("ListShares: could not stat resource")
Expand Down
2 changes: 1 addition & 1 deletion pkg/storage/utils/decomposedfs/node/permissions.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func (p *Permissions) AssemblePermissions(ctx context.Context, n *Node) (ap prov
// continue with next segment
}
if cn, err = cn.Parent(); err != nil {
return ap, errors.Wrap(err, "Decomposedfs: error getting parent "+cn.ParentID)
return ap, errors.Wrap(err, "Decomposedfs: error getting parent for node "+cn.ID)
}
}

Expand Down

0 comments on commit 62f956f

Please sign in to comment.