0
0
Fork 0

Fix user settings not getting validated (#25508)

This commit is contained in:
Claire 2023-06-19 15:06:06 +02:00 committed by GitHub
parent 804488d38e
commit dd07393e75
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View file

@ -72,7 +72,10 @@ class UserSettings
raise KeyError, "Undefined setting: #{key}" unless self.class.definition_for?(key)
typecast_value = self.class.definition_for(key).type_cast(value)
setting_definition = self.class.definition_for(key)
typecast_value = setting_definition.type_cast(value)
raise ArgumentError, "Invalid value for setting #{key}: #{typecast_value}" if setting_definition.in.present? && setting_definition.in.exclude?(typecast_value)
if typecast_value.nil?
@original_hash.delete(key)