Skip to content

Commit

Permalink
fix app open when multiple app providers are present
Browse files Browse the repository at this point in the history
  • Loading branch information
wkloucek committed Sep 29, 2021
1 parent ceb92c3 commit 9c827f8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions changelog/unreleased/app-registry-multiple-providers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Bugfix: Fix app open when multiple app providers are present

We've fixed the gateway behavior, that when multiple app providers are present, it always returned that we have duplicate names for app providers.
This was due the call to GetAllProviders() without any subsequent filtering by name. Now this filter mechanism is in place and the duplicate app providers error will only appear if a real duplicate is found.

https://github.com/cs3org/reva/issues/2095
https://github.com/cs3org/reva/pull/2117
10 changes: 10 additions & 0 deletions internal/grpc/services/gateway/appprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,16 @@ func (s *svc) findAppProvider(ctx context.Context, ri *storageprovider.ResourceI
return nil, err
}

// as long as the above mentioned GetAppProviderByName(app) method is not available
// we need to apply a manual filter
filteredProviders := []*registry.ProviderInfo{}
for _, p := range res.Providers {
if p.Name == app {
filteredProviders = append(filteredProviders, p)
}
}
res.Providers = filteredProviders

// if the list of app providers is empty means we expect a CODE_NOT_FOUND in the response
if res.Status.Code != rpc.Code_CODE_OK {
if res.Status.Code == rpc.Code_CODE_NOT_FOUND {
Expand Down

0 comments on commit 9c827f8

Please sign in to comment.