Fix AdvancedLoggingConfig validation (#25304)
Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
d8837fe313
Коммит
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()
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user