mirror of
https://github.com/Suwayomi/Tachidesk.git
synced 2025-12-10 06:42:07 +01:00
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:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user