Skip to content

Commit

Permalink
Removed stat to all storage providers in case of a Depth:0 PROPFIND t…
Browse files Browse the repository at this point in the history
…o "/"
  • Loading branch information
glpatcern committed Feb 5, 2024
1 parent 5ca283c commit 54069ed
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion internal/grpc/services/gateway/storageprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -1419,7 +1419,24 @@ func (s *svc) stat(ctx context.Context, req *provider.StatRequest) (*provider.St
return rsp, nil
}

return s.statAcrossProviders(ctx, req, providers)
// otherwise, this is a Stat for "/", which corresponds to a 0-Depth PROPFIND from web to just get the fileid:
// we respond with an hardcoded value, no need to poke all storage providers (see CERNBOX-3513)
info := &provider.ResourceInfo{
Id: &provider.ResourceId{
StorageId: "/",
OpaqueId: uuid.New().String(),
},
Type: provider.ResourceType_RESOURCE_TYPE_CONTAINER,
Path: req.Ref.GetPath(),
MimeType: "httpd/unix-directory",
Size: 0,
Mtime: &types.Timestamp{},
}

return &provider.StatResponse{
Status: status.NewOK(ctx),
Info: info,
}, nil
}

func (s *svc) statAcrossProviders(ctx context.Context, req *provider.StatRequest, providers []*registry.ProviderInfo) (*provider.StatResponse, error) {

Check failure on line 1442 in internal/grpc/services/gateway/storageprovider.go

View workflow job for this annotation

GitHub Actions / lint

func `(*svc).statAcrossProviders` is unused (unused)
Expand Down

0 comments on commit 54069ed

Please sign in to comment.