From b325c3a0ac3ecf4db2b7c344c5da3e69b44b3bc8 Mon Sep 17 00:00:00 2001 From: Ben Schumacher Date: Thu, 16 Nov 2023 21:22:01 +0100 Subject: [PATCH] Fix AdvancedLoggingConfig validation (#25304) Co-authored-by: Mattermost Build --- server/public/model/config.go | 2 +- server/public/model/config_test.go | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/server/public/model/config.go b/server/public/model/config.go index 8422ea56d8..b29f4c3737 100644 --- a/server/public/model/config.go +++ b/server/public/model/config.go @@ -1292,7 +1292,7 @@ func NewLogSettings() *LogSettings { func (s *LogSettings) isValid() *AppError { cfg := make(mlog.LoggerConfiguration) - err := json.Unmarshal(s.GetAdvancedLoggingConfig(), &cfg) + err := json.Unmarshal(s.AdvancedLoggingJSON, &cfg) if err != nil { return NewAppError("LogSettings.isValid", "model.config.is_valid.log.advanced_logging.json", map[string]any{"Error": err}, "", http.StatusBadRequest).Wrap(err) } diff --git a/server/public/model/config_test.go b/server/public/model/config_test.go index 48d7956059..b4824c3c3b 100644 --- a/server/public/model/config_test.go +++ b/server/public/model/config_test.go @@ -1297,6 +1297,12 @@ func TestLogSettingsIsValid(t *testing.T) { }, ExpectError: false, }, + "AdvancedLoggingConfig contains filepath": { + LogSettings: LogSettings{ + AdvancedLoggingConfig: sToP("/some/Path"), + }, + ExpectError: false, + }, } { t.Run(name, func(t *testing.T) { test.LogSettings.SetDefaults()