Fix updating server settings (#1805)

The server setting updater passed an already converted value to the setting validator, which then tried to convert the value again, which caused an error

Regression aa8d27f679
This commit is contained in:
schroda
2025-12-06 18:38:23 +01:00
committed by GitHub
parent a1ee1458e3
commit 4478042f40

View File

@@ -25,14 +25,7 @@ object SettingsUpdater {
if (property != null) { if (property != null) {
val stateFlow = property.get(serverConfig) val stateFlow = property.get(serverConfig)
val maybeConvertedValue = val validationError = SettingsValidator.validate(name, value)
SettingsRegistry
.get(name)
?.typeInfo
?.convertToInternalType
?.invoke(value) ?: value
val validationError = SettingsValidator.validate(name, maybeConvertedValue)
val isValid = validationError == null val isValid = validationError == null
if (!isValid) { if (!isValid) {
@@ -41,6 +34,13 @@ object SettingsUpdater {
return return
} }
val maybeConvertedValue =
SettingsRegistry
.get(name)
?.typeInfo
?.convertToInternalType
?.invoke(value) ?: value
// Normal update - MigratedConfigValue handles deprecated mappings automatically // Normal update - MigratedConfigValue handles deprecated mappings automatically
@Suppress("UNCHECKED_CAST") @Suppress("UNCHECKED_CAST")
(stateFlow as MutableStateFlow<Any>).value = maybeConvertedValue (stateFlow as MutableStateFlow<Any>).value = maybeConvertedValue