mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Fix AdvancedLoggingConfig validation (#25304)
Co-authored-by: Mattermost Build <build@mattermost.com>
This commit is contained in:
parent
d8837fe313
commit
b325c3a0ac
@ -1292,7 +1292,7 @@ func NewLogSettings() *LogSettings {
|
|||||||
|
|
||||||
func (s *LogSettings) isValid() *AppError {
|
func (s *LogSettings) isValid() *AppError {
|
||||||
cfg := make(mlog.LoggerConfiguration)
|
cfg := make(mlog.LoggerConfiguration)
|
||||||
err := json.Unmarshal(s.GetAdvancedLoggingConfig(), &cfg)
|
err := json.Unmarshal(s.AdvancedLoggingJSON, &cfg)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return NewAppError("LogSettings.isValid", "model.config.is_valid.log.advanced_logging.json", map[string]any{"Error": err}, "", http.StatusBadRequest).Wrap(err)
|
return NewAppError("LogSettings.isValid", "model.config.is_valid.log.advanced_logging.json", map[string]any{"Error": err}, "", http.StatusBadRequest).Wrap(err)
|
||||||
}
|
}
|
||||||
|
@ -1297,6 +1297,12 @@ func TestLogSettingsIsValid(t *testing.T) {
|
|||||||
},
|
},
|
||||||
ExpectError: false,
|
ExpectError: false,
|
||||||
},
|
},
|
||||||
|
"AdvancedLoggingConfig contains filepath": {
|
||||||
|
LogSettings: LogSettings{
|
||||||
|
AdvancedLoggingConfig: sToP("/some/Path"),
|
||||||
|
},
|
||||||
|
ExpectError: false,
|
||||||
|
},
|
||||||
} {
|
} {
|
||||||
t.Run(name, func(t *testing.T) {
|
t.Run(name, func(t *testing.T) {
|
||||||
test.LogSettings.SetDefaults()
|
test.LogSettings.SetDefaults()
|
||||||
|
Loading…
Reference in New Issue
Block a user