Skip to content

Commit

Permalink
remove excess info from the http list app providers endpoint (#2149)
Browse files Browse the repository at this point in the history
  • Loading branch information
wkloucek authored Oct 11, 2021
1 parent 26bc95f commit d39f89c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
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

0 comments on commit d39f89c

Please sign in to comment.