diff --git a/changelog/unreleased/app-registry-multiple-providers.md b/changelog/unreleased/app-registry-multiple-providers.md new file mode 100644 index 0000000000..0a004173fc --- /dev/null +++ b/changelog/unreleased/app-registry-multiple-providers.md @@ -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 diff --git a/internal/grpc/services/gateway/appprovider.go b/internal/grpc/services/gateway/appprovider.go index 3a895a98a7..58b0583144 100644 --- a/internal/grpc/services/gateway/appprovider.go +++ b/internal/grpc/services/gateway/appprovider.go @@ -283,15 +283,19 @@ func (s *svc) findAppProvider(ctx context.Context, ri *storageprovider.ResourceI return nil, errtypes.InternalError("gateway: error finding app providers") } - // if we only have one app provider we verify that it matches the requested app name - if len(res.Providers) == 1 { - p := res.Providers[0] + // 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 { - return p, nil + filteredProviders = append(filteredProviders, p) } - // we return error if we return the wrong app provider - err = errtypes.InternalError(fmt.Sprintf("gateway: user asked for app %q and we gave %q", app, p.Name)) - return nil, err + } + res.Providers = filteredProviders + + // if we only have one app provider we verify that it matches the requested app name + if len(res.Providers) == 1 { + return res.Providers[0], nil } // we should never arrive to the point of having more than one