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

remove excess info from the http list app providers endpoint #2149

Merged
merged 2 commits into from
Oct 11, 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
10 changes: 10 additions & 0 deletions changelog/unreleased/app-provider-remove-excess-info.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Bugfix: Remove excess info from the http list app providers endpoint

We've removed excess info from the http list app providers endpoint.
The app provider section contained all mime types supported by a certain app provider,
which led to a very big JSON payload and since they are not used they have been removed again.
Mime types not on the mime type configuration list always had `application/octet-stream` as a file extension and `APPLICATION/OCTET-STREAM file` as name and description. Now these information are just omitted.

https://github.com/cs3org/reva/pull/2149
https://github.com/owncloud/ocis/pull/2603
https://github.com/cs3org/reva/pull/2138
7 changes: 7 additions & 0 deletions internal/grpc/services/appregistry/appregistry.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,13 @@ func (s *svc) ListSupportedMimeTypes(ctx context.Context, req *registrypb.ListSu
}, nil
}

// hide mimetypes for app providers
for _, mime := range mimeTypes {
for _, app := range mime.AppProviders {
app.MimeTypes = nil
}
}

res := &registrypb.ListSupportedMimeTypesResponse{
Status: status.NewOK(ctx),
MimeTypes: mimeTypes,
Expand Down
13 changes: 5 additions & 8 deletions pkg/app/registry/static/static.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (
"github.com/cs3org/reva/pkg/app"
"github.com/cs3org/reva/pkg/app/registry/registry"
"github.com/cs3org/reva/pkg/errtypes"
"github.com/cs3org/reva/pkg/mime"
"github.com/mitchellh/mapstructure"
"github.com/rs/zerolog/log"
orderedmap "github.com/wk8/go-ordered-map"
Expand Down Expand Up @@ -265,14 +264,12 @@ func (m *manager) SetDefaultProviderForMimeType(ctx context.Context, mimeType st
}

func dummyMimeType(m string, apps []*registrypb.ProviderInfo) *mimeTypeConfig {
ext := mime.Detect(false, m)

return &mimeTypeConfig{
MimeType: m,
apps: apps,
Extension: ext,
Name: fmt.Sprintf("%s file", strings.ToUpper(ext)),
Description: fmt.Sprintf("%s file", strings.ToUpper(ext)),
MimeType: m,
apps: apps,
//Extension: "", // there is no meaningful general extension, so omit it
//Name: "", // there is no meaningful general name, so omit it
//Description: "", // there is no meaningful general description, so omit it
}
}

Expand Down