Merge pull request #2603 from gmgigi96/appregistry-config

[full-ci] Updated MimeTypes configuration for AppRegistry
This commit is contained in:
Willy Kloucek
2021-10-12 10:07:03 +02:00
committed by GitHub
6 changed files with 86 additions and 49 deletions

View File

@@ -0,0 +1,6 @@
Enhancement: Updated MimeTypes configuration for AppRegistry
We updated the type of the mime types config to a list, to keep
the order of mime types from the config.
https://github.com/owncloud/ocis/pull/2603

View File

@@ -1,5 +1,6 @@
{
"application/pdf": {
[
{
"mime_type": "application/pdf",
"extension": "pdf",
"name": "PDF",
"description": "PDF document",
@@ -7,7 +8,8 @@
"default_app": "",
"allow_creation": false
},
"application/vnd.oasis.opendocument.text": {
{
"mime_type": "application/vnd.oasis.opendocument.text",
"extension": "odt",
"name": "OpenDocument",
"description": "OpenDocument text document",
@@ -15,7 +17,8 @@
"default_app": "Collabora",
"allow_creation": true
},
"application/vnd.oasis.opendocument.spreadsheet": {
{
"mime_type": "application/vnd.oasis.opendocument.spreadsheet",
"extension": "ods",
"name": "OpenSpreadsheet",
"description": "OpenDocument spreadsheet document",
@@ -23,7 +26,8 @@
"default_app": "Collabora",
"allow_creation": true
},
"application/vnd.oasis.opendocument.presentation": {
{
"mime_type": "application/vnd.oasis.opendocument.presentation",
"extension": "odp",
"name": "OpenPresentation",
"description": "OpenDocument presentation document",
@@ -31,7 +35,8 @@
"default_app": "Collabora",
"allow_creation": true
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": {
{
"mime_type": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"extension": "docx",
"name": "Microsoft Word",
"description": "Microsoft Word document",
@@ -39,7 +44,8 @@
"default_app": "OnlyOffice",
"allow_creation": true
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
{
"mime_type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"extension": "xlsx",
"name": "Microsoft Excel",
"description": "Microsoft Excel document",
@@ -47,7 +53,8 @@
"default_app": "OnlyOffice",
"allow_creation": true
},
"application/vnd.openxmlformats-officedocument.presentationml.presentation": {
{
"mime_type": "application/vnd.openxmlformats-officedocument.presentationml.presentation",
"extension": "pptx",
"name": "Microsoft PowerPoint",
"description": "Microsoft PowerPoint document",
@@ -55,7 +62,8 @@
"default_app": "OnlyOffice",
"allow_creation": true
},
"application/vnd.jupyter": {
{
"mime_type": "application/vnd.jupyter",
"extension": "ipynb",
"name": "Jupyter Notebook",
"description": "Jupyter Notebook",
@@ -63,7 +71,8 @@
"default_app": "",
"allow_creation": true
},
"text/markdown": {
{
"mime_type": "text/markdown",
"extension": "md",
"name": "Markdown file",
"description": "Markdown file",
@@ -71,7 +80,8 @@
"default_app": "CodiMD",
"allow_creation": true
},
"application/compressed-markdown": {
{
"mime_type": "application/compressed-markdown",
"extension": "zmd",
"name": "Compressed markdown file",
"description": "Compressed markdown file",
@@ -79,4 +89,4 @@
"default_app": "CodiMD",
"allow_creation": false
}
}
]

6
go.mod
View File

@@ -19,8 +19,8 @@ require (
github.com/asim/go-micro/v3 v3.6.1-0.20210924081004-8c39b1e1204d
github.com/blevesearch/bleve/v2 v2.1.0
github.com/coreos/go-oidc/v3 v3.0.0
github.com/cs3org/go-cs3apis v0.0.0-20210922150613-cb9e3c99f8de
github.com/cs3org/reva v1.13.1-0.20211006080436-67f39be571fa
github.com/cs3org/go-cs3apis v0.0.0-20211007101428-6d142794ec11
github.com/cs3org/reva v1.13.1-0.20211012070754-5dbb87c8e084
github.com/disintegration/imaging v1.6.2
github.com/glauth/glauth v1.1.3-0.20210729125545-b9aecdfcac31
github.com/go-chi/chi/v5 v5.0.4
@@ -58,7 +58,7 @@ require (
github.com/urfave/cli/v2 v2.3.0
github.com/yaegashi/msgraph.go v0.1.4
go.opencensus.io v0.23.0
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.24.0
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.25.0
go.opentelemetry.io/otel v1.0.1
go.opentelemetry.io/otel/exporters/jaeger v1.0.1
go.opentelemetry.io/otel/sdk v1.0.1

16
go.sum
View File

@@ -289,10 +289,10 @@ github.com/crewjam/httperr v0.2.0/go.mod h1:Jlz+Sg/XqBQhyMjdDiC+GNNRzZTD7x39Gu3p
github.com/crewjam/saml v0.4.5 h1:H9u+6CZAESUKHxMyxUbVn0IawYvKZn4nt3d4ccV4O/M=
github.com/crewjam/saml v0.4.5/go.mod h1:qCJQpUtZte9R1ZjUBcW8qtCNlinbO363ooNl02S68bk=
github.com/cs3org/cato v0.0.0-20200828125504-e418fc54dd5e/go.mod h1:XJEZ3/EQuI3BXTp/6DUzFr850vlxq11I6satRtz0YQ4=
github.com/cs3org/go-cs3apis v0.0.0-20210922150613-cb9e3c99f8de h1:N+AI8wz7yhDDqHDuq9EGaqQoFhAOi9XW37xt0ormflw=
github.com/cs3org/go-cs3apis v0.0.0-20210922150613-cb9e3c99f8de/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY=
github.com/cs3org/reva v1.13.1-0.20211006080436-67f39be571fa h1:sKNIaZ7rZFi+32Wnv8Z8Tc+J4gh0AYrUjaxl0Uk8JCQ=
github.com/cs3org/reva v1.13.1-0.20211006080436-67f39be571fa/go.mod h1:z1GjBB1gBv2olyqhWpTbL+JOobb2Q+GCSebR09x797A=
github.com/cs3org/go-cs3apis v0.0.0-20211007101428-6d142794ec11 h1:cc/8fdzWdr/wAZOXb29J8bnXjo1poCMCLwhlFBlvhfI=
github.com/cs3org/go-cs3apis v0.0.0-20211007101428-6d142794ec11/go.mod h1:UXha4TguuB52H14EMoSsCqDj7k8a/t7g4gVP+bgY5LY=
github.com/cs3org/reva v1.13.1-0.20211012070754-5dbb87c8e084 h1:7uwU6ui+9cRdsyb8PaflexI2TY51LVYiDNOzBLDgHQs=
github.com/cs3org/reva v1.13.1-0.20211012070754-5dbb87c8e084/go.mod h1:uENdZEtDFmTRt6+d4+Ro4P5XnNL+9I6gwftHEBJzHQw=
github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8 h1:Z9lwXumT5ACSmJ7WGnFl+OMLLjpz5uR2fyz7dC255FI=
github.com/cubewise-code/go-mime v0.0.0-20200519001935-8c5762b177d8/go.mod h1:4abs/jPXcmJzYoYGF91JF9Uq9s/KL5n1jvFDix8KcqY=
github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4=
@@ -1113,6 +1113,8 @@ github.com/vinyldns/go-vinyldns v0.0.0-20200917153823-148a5f6b8f14/go.mod h1:RWc
github.com/vultr/govultr v0.1.4/go.mod h1:9H008Uxr/C4vFNGLqKx232C206GL0PBHzOP0809bGNA=
github.com/vultr/govultr/v2 v2.0.0/go.mod h1:2PsEeg+gs3p/Fo5Pw8F9mv+DUBEOlrNZ8GmCTGmhOhs=
github.com/willf/bitset v1.1.10/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
github.com/wk8/go-ordered-map v0.2.0 h1:KlvGyHstD1kkGZkPtHCyCfRYS0cz84uk6rrW/Dnhdtk=
github.com/wk8/go-ordered-map v0.2.0/go.mod h1:9ZIbRunKbuvfPKyBP1SIKLcXNlv74YCOZ3t3VTS6gRk=
github.com/xanzy/ssh-agent v0.2.1/go.mod h1:mLlQY/MoOhWBj+gOGMQkOeiEvkx+8pJSI+0Bx9h2kr4=
github.com/xanzy/ssh-agent v0.3.0 h1:wUMzuKtKilRgBAD1sUb8gOwwRr2FGoBVumcjoOACClI=
github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6eAcqrDh0=
@@ -1159,16 +1161,14 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M=
go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E=
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.24.0 h1:1hCzM7mwQbFQgk3Q4lAVEsGV6NB4Uj6Jt3EU+OiSBc8=
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.24.0/go.mod h1:O0cG0vP6TP3c323kh70JmeG1jN69Sn9Z5HxgmeASFWY=
go.opentelemetry.io/otel v1.0.0/go.mod h1:AjRVh9A5/5DE7S+mZtTR6t8vpKKryam+0lREnfmS4cg=
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.25.0 h1:Wx7nFnvCaissIUZxPkBqDz2963Z+Cl+PkYbDKzTxDqQ=
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.25.0/go.mod h1:E5NNboN0UqSAki0Atn9kVwaN7I+l25gGxDqBueo/74E=
go.opentelemetry.io/otel v1.0.1 h1:4XKyXmfqJLOQ7feyV5DB6gsBFZ0ltB8vLtp6pj4JIcc=
go.opentelemetry.io/otel v1.0.1/go.mod h1:OPEOD4jIT2SlZPMmwT6FqZz2C0ZNdQqiWcoK6M0SNFU=
go.opentelemetry.io/otel/exporters/jaeger v1.0.1 h1:fg9udWIWWJMAT+Gq2ATFd/DFy3OZvKEZy9VK2amxvkw=
go.opentelemetry.io/otel/exporters/jaeger v1.0.1/go.mod h1:85Ym3qknJdIdfRzYS9Ofy9NeLi9gKPFzFDBEHCKpfXI=
go.opentelemetry.io/otel/sdk v1.0.1 h1:wXxFEWGo7XfXupPwVJvTBOaPBC9FEg0wB8hMNrKk+cA=
go.opentelemetry.io/otel/sdk v1.0.1/go.mod h1:HrdXne+BiwsOHYYkBE5ysIcv2bvdZstxzmCQhxTcZkI=
go.opentelemetry.io/otel/trace v1.0.0/go.mod h1:PXTWqayeFUlJV1YDNhsJYB184+IvAH814St6o6ajzIs=
go.opentelemetry.io/otel/trace v1.0.1 h1:StTeIH6Q3G4r0Fiw34LTokUFESZgIDUr0qIJ7mKmAfw=
go.opentelemetry.io/otel/trace v1.0.1/go.mod h1:5g4i4fKLaX2BQpSBsxw8YYcgKpMMSW3x7ZTuYBr3sUk=
go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=

View File

@@ -1,5 +1,6 @@
{
"application/pdf": {
[
{
"mime_type": "application/pdf",
"extension": "pdf",
"name": "PDF",
"description": "PDF document",
@@ -7,7 +8,8 @@
"default_app": "",
"allow_creation": false
},
"application/vnd.oasis.opendocument.text": {
{
"mime_type": "application/vnd.oasis.opendocument.text",
"extension": "odt",
"name": "OpenDocument",
"description": "OpenDocument text document",
@@ -15,7 +17,8 @@
"default_app": "",
"allow_creation": true
},
"application/vnd.oasis.opendocument.spreadsheet": {
{
"mime_type": "application/vnd.oasis.opendocument.spreadsheet",
"extension": "ods",
"name": "OpenSpreadsheet",
"description": "OpenDocument spreadsheet document",
@@ -23,7 +26,8 @@
"default_app": "",
"allow_creation": true
},
"application/vnd.oasis.opendocument.presentation": {
{
"mime_type": "application/vnd.oasis.opendocument.presentation",
"extension": "odp",
"name": "OpenPresentation",
"description": "OpenDocument presentation document",
@@ -31,7 +35,8 @@
"default_app": "",
"allow_creation": true
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": {
{
"mime_type": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"extension": "docx",
"name": "Microsoft Word",
"description": "Microsoft Word document",
@@ -39,7 +44,8 @@
"default_app": "",
"allow_creation": true
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
{
"mime_type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"extension": "xlsx",
"name": "Microsoft Excel",
"description": "Microsoft Excel document",
@@ -47,7 +53,8 @@
"default_app": "",
"allow_creation": true
},
"application/vnd.openxmlformats-officedocument.presentationml.presentation": {
{
"mime_type": "application/vnd.openxmlformats-officedocument.presentationml.presentation",
"extension": "pptx",
"name": "Microsoft PowerPoint",
"description": "Microsoft PowerPoint document",
@@ -55,7 +62,8 @@
"default_app": "",
"allow_creation": true
},
"application/vnd.jupyter": {
{
"mime_type": "application/vnd.jupyter",
"extension": "ipynb",
"name": "Jupyter Notebook",
"description": "Jupyter Notebook",
@@ -63,7 +71,8 @@
"default_app": "",
"allow_creation": true
},
"text/markdown": {
{
"mime_type": "text/markdown",
"extension": "md",
"name": "Markdown file",
"description": "Markdown file",
@@ -71,7 +80,8 @@
"default_app": "",
"allow_creation": true
},
"application/compressed-markdown": {
{
"mime_type": "application/compressed-markdown",
"extension": "zmd",
"name": "Compressed markdown file",
"description": "Compressed markdown file",
@@ -79,4 +89,4 @@
"default_app": "",
"allow_creation": false
}
}
]

View File

@@ -230,9 +230,10 @@ func rules(cfg *config.Config, logger log.Logger) map[string]map[string]interfac
}
}
func mimetypes(cfg *config.Config, logger log.Logger) map[string]map[string]interface{} {
func mimetypes(cfg *config.Config, logger log.Logger) []map[string]interface{} {
type mimeTypeConfig struct {
MimeType string `json:"mime_type" mapstructure:"mime_type"`
Extension string `json:"extension" mapstructure:"extension"`
Name string `json:"name" mapstructure:"name"`
Description string `json:"description" mapstructure:"description"`
@@ -240,8 +241,8 @@ func mimetypes(cfg *config.Config, logger log.Logger) map[string]map[string]inte
DefaultApp string `json:"default_app" mapstructure:"default_app"`
AllowCreation bool `json:"allow_creation" mapstructure:"allow_creation"`
}
var mimetypes map[string]mimeTypeConfig
var m map[string]map[string]interface{}
var mimetypes []mimeTypeConfig
var m []map[string]interface{}
// load default app mimetypes from a json file
if cfg.Reva.AppRegistry.MimetypesJSON != "" {
@@ -263,60 +264,70 @@ func mimetypes(cfg *config.Config, logger log.Logger) map[string]map[string]inte
logger.Info().Msg("No app registry mimetypes JSON file provided, loading default configuration")
mimetypes = map[string]mimeTypeConfig{
"application/pdf": {
mimetypes = []mimeTypeConfig{
{
MimeType: "application/pdf",
Extension: "pdf",
Name: "PDF",
Description: "PDF document",
},
"application/vnd.oasis.opendocument.text": {
{
MimeType: "application/vnd.oasis.opendocument.text",
Extension: "odt",
Name: "OpenDocument",
Description: "OpenDocument text document",
AllowCreation: true,
},
"application/vnd.oasis.opendocument.spreadsheet": {
{
MimeType: "application/vnd.oasis.opendocument.spreadsheet",
Extension: "ods",
Name: "OpenSpreadsheet",
Description: "OpenDocument spreadsheet document",
AllowCreation: true,
},
"application/vnd.oasis.opendocument.presentation": {
{
MimeType: "application/vnd.oasis.opendocument.presentation",
Extension: "odp",
Name: "OpenPresentation",
Description: "OpenDocument presentation document",
AllowCreation: true,
},
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": {
{
MimeType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
Extension: "docx",
Name: "Microsoft Word",
Description: "Microsoft Word document",
AllowCreation: true,
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
{
MimeType: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
Extension: "xlsx",
Name: "Microsoft Excel",
Description: "Microsoft Excel document",
AllowCreation: true,
},
"application/vnd.openxmlformats-officedocument.presentationml.presentation": {
{
MimeType: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
Extension: "pptx",
Name: "Microsoft PowerPoint",
Description: "Microsoft PowerPoint document",
AllowCreation: true,
},
"application/vnd.jupyter": {
{
MimeType: "application/vnd.jupyter",
Extension: "ipynb",
Name: "Jupyter Notebook",
Description: "Jupyter Notebook",
},
"text/markdown": {
{
MimeType: "text/markdown",
Extension: "md",
Name: "Markdown file",
Description: "Markdown file",
AllowCreation: true,
},
"application/compressed-markdown": {
{
MimeType: "application/compressed-markdown",
Extension: "zmd",
Name: "Compressed markdown file",
Description: "Compressed markdown file",