Skip to content

Commit

Permalink
linter
Browse files Browse the repository at this point in the history
  • Loading branch information
micbar committed Mar 22, 2022
1 parent 892a49f commit ca08779
Showing 1 changed file with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ func (s *service) ListStorageSpaces(ctx context.Context, req *provider.ListStora
}
}
// only display the shares jail if we have accepted shares
if atLeastOneAccepted == true {
if atLeastOneAccepted {
opaque = utils.AppendPlainToOpaque(opaque, "spaceAlias", "virtual/shares")
space := &provider.StorageSpace{
Opaque: opaque,
Expand Down Expand Up @@ -660,6 +660,18 @@ func (s *service) Stat(ctx context.Context, req *provider.StatRequest) (*provide
return nil, err
}
earliestShare, _ := findEarliestShare(receivedShares)

resourceResp, err := s.gateway.Stat(ctx, &provider.StatRequest{
Ref: &provider.Reference{
ResourceId: earliestShare.ResourceId,
},
})
if err != nil {
return nil, errors.Wrap(err, "Transport error while stating the earliest share resource")
}
if resourceResp.Status.Code != rpc.Code_CODE_OK {
return nil, errors.New("Could not stat earliest share resource")
}
// The root is empty, it is filled by mountpoints
return &provider.StatResponse{
Status: status.NewOK(ctx),
Expand All @@ -677,7 +689,7 @@ func (s *service) Stat(ctx context.Context, req *provider.StatRequest) (*provide
OpaqueId: utils.ShareStorageProviderID,
},
Type: provider.ResourceType_RESOURCE_TYPE_CONTAINER,
Mtime: earliestShare.Mtime, // TODO, use the mtime of the latest resource
Mtime: resourceResp.Info.Mtime,
Path: "/",
MimeType: "httpd/unix-directory",
Size: 0,
Expand Down Expand Up @@ -954,7 +966,6 @@ func (s *service) fetchShares(ctx context.Context) ([]*collaboration.ReceivedSha
}

func findEarliestShare(receivedShares []*collaboration.ReceivedShare) (earliestShare *collaboration.Share, atLeastOneAccepted bool) {
// Lookup the last changed received share and use its etag for the share jail.
atLeastOneAccepted = false
for _, rs := range receivedShares {
current := rs.Share
Expand Down

0 comments on commit ca08779

Please sign in to comment.