Skip to content

Commit 989b01d

Browse files
authored
Removed stat to all storage providers on a Depth:0 PROPFIND to "/" (#4497)
1 parent 5ca283c commit 989b01d

File tree

2 files changed

+8
-34
lines changed

2 files changed

+8
-34
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Bugfix: removed stat to all storage providers on Depth:0 PROPFIND to "/"
2+
3+
This PR removes an unnecessary and potentially problematic call, which would
4+
fail if any of the configured storage providers has an issue.
5+
6+
https://github.com/cs3org/reva/pull/4497

internal/grpc/services/gateway/storageprovider.go

+2-34
Original file line numberDiff line numberDiff line change
@@ -1419,12 +1419,8 @@ func (s *svc) stat(ctx context.Context, req *provider.StatRequest) (*provider.St
14191419
return rsp, nil
14201420
}
14211421

1422-
return s.statAcrossProviders(ctx, req, providers)
1423-
}
1424-
1425-
func (s *svc) statAcrossProviders(ctx context.Context, req *provider.StatRequest, providers []*registry.ProviderInfo) (*provider.StatResponse, error) {
1426-
// TODO(ishank011): aggregrate properties such as etag, checksum, etc.
1427-
log := appctx.GetLogger(ctx)
1422+
// otherwise, this is a Stat for "/", which corresponds to a 0-Depth PROPFIND from web to just get the fileid:
1423+
// we respond with an hardcoded value, no need to poke all storage providers as we did before
14281424
info := &provider.ResourceInfo{
14291425
Id: &provider.ResourceId{
14301426
StorageId: "/",
@@ -1437,34 +1433,6 @@ func (s *svc) statAcrossProviders(ctx context.Context, req *provider.StatRequest
14371433
Mtime: &types.Timestamp{},
14381434
}
14391435

1440-
for _, p := range providers {
1441-
c, err := s.getStorageProviderClient(ctx, p)
1442-
if err != nil {
1443-
log.Err(err).Msg("error connecting to storage provider=" + p.Address)
1444-
continue
1445-
}
1446-
resp, err := c.Stat(ctx, req)
1447-
if err != nil {
1448-
log.Err(err).Msgf("gateway: error calling Stat %s: %+v", req.Ref.String(), p)
1449-
continue
1450-
}
1451-
if resp.Status.Code != rpc.Code_CODE_OK {
1452-
log.Err(status.NewErrorFromCode(rpc.Code_CODE_OK, "gateway")).Send()
1453-
continue
1454-
}
1455-
if resp.Info != nil {
1456-
info.Size += resp.Info.Size
1457-
if utils.TSToUnixNano(resp.Info.Mtime) > utils.TSToUnixNano(info.Mtime) {
1458-
info.Mtime = resp.Info.Mtime
1459-
info.Etag = resp.Info.Etag
1460-
info.Checksum = resp.Info.Checksum
1461-
}
1462-
if info.Etag == "" && info.Etag != resp.Info.Etag {
1463-
info.Etag = resp.Info.Etag
1464-
}
1465-
}
1466-
}
1467-
14681436
return &provider.StatResponse{
14691437
Status: status.NewOK(ctx),
14701438
Info: info,

0 commit comments

Comments
 (0)