Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix app open when multiple app providers are present #2118

Merged
merged 3 commits into from
Oct 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
18 changes: 11 additions & 7 deletions internal/grpc/services/gateway/appprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down