fix(graph): Don't return OCM shares in the drives list
OCM shares don't have mountpoints currently. So they're no supposed to show up in the drives list on the graph service. Fixes: #10689
This commit is contained in:
@@ -0,0 +1,7 @@
|
|||||||
|
Bugfix: Fix graph drives response for federated shares
|
||||||
|
|
||||||
|
Federated shares where erroneously showing up in the /me/drives response
|
||||||
|
on the graph API.
|
||||||
|
|
||||||
|
https://github.com/owncloud/ocis/pull/10730
|
||||||
|
https://github.com/owncloud/ocis/issues/10689
|
||||||
@@ -645,6 +645,10 @@ func (g Graph) formatDrives(ctx context.Context, baseURL *url.URL, storageSpaces
|
|||||||
for i := 0; i < numWorkers; i++ {
|
for i := 0; i < numWorkers; i++ {
|
||||||
errg.Go(func() error {
|
errg.Go(func() error {
|
||||||
for storageSpace := range work {
|
for storageSpace := range work {
|
||||||
|
if storageSpace.GetRoot().GetStorageId() == utils.OCMStorageProviderID {
|
||||||
|
// skip OCM shares they are no supposed to show up in the drives list
|
||||||
|
continue
|
||||||
|
}
|
||||||
res, err := g.cs3StorageSpaceToDrive(ctx, baseURL, storageSpace, apiVersion)
|
res, err := g.cs3StorageSpaceToDrive(ctx, baseURL, storageSpace, apiVersion)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -679,11 +683,9 @@ func (g Graph) formatDrives(ctx context.Context, baseURL *url.URL, storageSpaces
|
|||||||
close(results)
|
close(results)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
responses := make([]*libregraph.Drive, len(storageSpaces))
|
responses := make([]*libregraph.Drive, 0, len(storageSpaces))
|
||||||
i := 0
|
|
||||||
for r := range results {
|
for r := range results {
|
||||||
responses[i] = r
|
responses = append(responses, r)
|
||||||
i++
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := errg.Wait(); err != nil {
|
if err := errg.Wait(); err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user