diff --git a/CHANGELOG.md b/CHANGELOG.md index 31fc3c08f..535b3adf3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,8 @@ The following sections list the changes for unreleased. * Bugfix - Fix wrong naming in nats-js-kv registry: [#8140](https://github.com/owncloud/ocis/pull/8140) * Bugfix - IDP CS3 backend sessions now survire restart: [#8142](https://github.com/owncloud/ocis/pull/8142) * Bugfix - Fix patching of language: [#8182](https://github.com/owncloud/ocis/pull/8182) +* Bugfix - Fix search service to not log expected cases as errors: [#8200](https://github.com/owncloud/ocis/pull/8200) +* Bugfix - Updating and reset logo failed: [#8211](https://github.com/owncloud/ocis/pull/8211) * Enhancement - Disable the password policy: [#7985](https://github.com/owncloud/ocis/pull/7985) * Enhancement - Update antivirus service: [#8062](https://github.com/owncloud/ocis/pull/8062) * Enhancement - Update reva to latest edge version: [#8100](https://github.com/owncloud/ocis/pull/8100) @@ -95,6 +97,21 @@ The following sections list the changes for unreleased. https://github.com/owncloud/ocis/pull/8182 +* Bugfix - Fix search service to not log expected cases as errors: [#8200](https://github.com/owncloud/ocis/pull/8200) + + We changed the search service to not log cases where resources that were about + to be indexed can no longer be found. Those are expected cases, e.g. when the + file in question has already been deleted or renamed meanwhile. + + https://github.com/owncloud/ocis/pull/8200 + +* Bugfix - Updating and reset logo failed: [#8211](https://github.com/owncloud/ocis/pull/8211) + + We fixed a bug when admin tried to update or reset the logo. + + https://github.com/owncloud/ocis/issues/8101 + https://github.com/owncloud/ocis/pull/8211 + * Enhancement - Disable the password policy: [#7985](https://github.com/owncloud/ocis/pull/7985) We add the environment variable that allow to disable the password policy. diff --git a/changelog/unreleased/fix-search-logging.md b/changelog/unreleased/fix-search-logging.md new file mode 100644 index 000000000..a9347c74d --- /dev/null +++ b/changelog/unreleased/fix-search-logging.md @@ -0,0 +1,6 @@ +Bugfix: Fix search service to not log expected cases as errors + +We changed the search service to not log cases where resources that were about to be indexed can no longer be found. +Those are expected cases, e.g. when the file in question has already been deleted or renamed meanwhile. + +https://github.com/owncloud/ocis/pull/8200 diff --git a/changelog/unreleased/fix-upload-reset-logo.md b/changelog/unreleased/fix-upload-reset-logo.md new file mode 100644 index 000000000..7077a0068 --- /dev/null +++ b/changelog/unreleased/fix-upload-reset-logo.md @@ -0,0 +1,6 @@ +Bugfix: Updating and reset logo failed + +We fixed a bug when admin tried to update or reset the logo. + +https://github.com/owncloud/ocis/pull/8211 +https://github.com/owncloud/ocis/issues/8101 diff --git a/services/search/pkg/search/search.go b/services/search/pkg/search/search.go index 77eb5b741..6bce856ea 100644 --- a/services/search/pkg/search/search.go +++ b/services/search/pkg/search/search.go @@ -88,13 +88,17 @@ func statResource(ctx context.Context, ref *provider.Reference, gatewaySelector logger.Error().Err(err).Msg("failed to stat the moved resource") return nil, err } - if res.Status.Code != rpc.Code_CODE_OK { + switch res.Status.Code { + case rpc.Code_CODE_OK: + return res, nil + case rpc.Code_CODE_NOT_FOUND: + // Resource was moved or deleted in the meantime. ignore. + return nil, err + default: err := errors.New("failed to stat the moved resource") logger.Error().Interface("res", res).Msg(err.Error()) return nil, err } - - return res, nil } // NOTE: this converts CS3 to WebDAV permissions diff --git a/services/web/pkg/service/v0/branding.go b/services/web/pkg/service/v0/branding.go index 7afaf46e0..06606387b 100644 --- a/services/web/pkg/service/v0/branding.go +++ b/services/web/pkg/service/v0/branding.go @@ -145,12 +145,7 @@ func (p Web) getLogoPath(r io.Reader) (string, error) { var m map[string]interface{} _ = json.NewDecoder(r).Decode(&m) - webCfg, ok := m["clients"].(map[string]interface{})["web"].(map[string]interface{}) - if !ok { - return "", errInvalidThemeConfig - } - - logoCfg, ok := webCfg["defaults"].(map[string]interface{})["logo"].(map[string]interface{}) + logoCfg, ok := extractMap(m, "clients", "web", "defaults", "logo") if !ok { return "", errInvalidThemeConfig } @@ -175,18 +170,13 @@ func (p Web) updateLogoThemeConfig(logoPath string) error { _ = json.NewDecoder(f).Decode(&m) // change logo in common part - commonCfg, ok := m["common"].(map[string]interface{}) + commonCfg, ok := extractMap(m, "common") if !ok { return errInvalidThemeConfig } commonCfg["logo"] = logoPath - webCfg, ok := m["clients"].(map[string]interface{})["web"].(map[string]interface{}) - if !ok { - return errInvalidThemeConfig - } - - logoCfg, ok := webCfg["defaults"].(map[string]interface{})["logo"].(map[string]interface{}) + logoCfg, ok := extractMap(m, "clients", "web", "defaults", "logo") if !ok { return errInvalidThemeConfig } @@ -209,3 +199,16 @@ func allowedFiletype(filename, mediatype string) bool { mt, ok := _allowedExtensionMediatypes[ext] return ok && mt == mediatype } + +// extractMap extracts embedded map[string]interface{} by the keys chain +func extractMap(data map[string]interface{}, keys ...string) (map[string]interface{}, bool) { + last := data + var ok bool + for _, key := range keys { + last, ok = last[key].(map[string]interface{}) + if !ok { + return nil, false + } + } + return last, true +}