Merge pull request #8220 from aduffeck/merge-master-b758d28-stable-5.0

Merge master b758d28 stable 5.0
This commit is contained in:
Andre Duffeck
2024-01-16 17:38:03 +01:00
committed by GitHub
5 changed files with 52 additions and 16 deletions

View File

@@ -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.

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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
}