diff --git a/changelog/unreleased/appprovider-panic-fix.md b/changelog/unreleased/appprovider-panic-fix.md new file mode 100644 index 0000000000..c0c4bfffcf --- /dev/null +++ b/changelog/unreleased/appprovider-panic-fix.md @@ -0,0 +1,5 @@ +Bugfix: Fixes panic in case of empty configuration + +Makes sure the config map is allocated prior to setting it + +https://github.com/cs3org/reva/pull/3455 diff --git a/internal/grpc/services/appprovider/appprovider.go b/internal/grpc/services/appprovider/appprovider.go index 9c209e8fb8..453fb8698c 100644 --- a/internal/grpc/services/appprovider/appprovider.go +++ b/internal/grpc/services/appprovider/appprovider.go @@ -200,8 +200,13 @@ func (s *service) Register(ss *grpc.Server) { func getProvider(c *config) (app.Provider, error) { if f, ok := registry.NewFuncs[c.Driver]; ok { driverConf := c.Drivers[c.Driver] - // share the mime_types config entry to the drivers - driverConf["mime_types"] = c.MimeTypes + if c.MimeTypes != nil { + // share the mime_types config entry to the drivers + if driverConf == nil { + driverConf = make(map[string]interface{}) + } + driverConf["mime_types"] = c.MimeTypes + } return f(driverConf) } return nil, errtypes.NotFound("driver not found: " + c.Driver)