FIX: Correctly sanitize negative integers in site settings (#24170)

As part of #23816, which sought to strip out thousand separators, we also accidentally strip out signs. This is making it impossible to disable some settings which require a -1 to disable. Instead of stripping non-digits, strip anything that isn't a sign or a digit.
This commit is contained in:
Ted Johansson
2023-10-31 10:21:30 +08:00
committed by GitHub
parent 974c508cc8
commit 84fdf40dd4
2 changed files with 11 additions and 1 deletions

View File

@@ -33,7 +33,7 @@ class Admin::SiteSettingsController < Admin::AdminController
case SiteSetting.type_supervisor.get_type(id)
when :integer
value = value.gsub(/\D/, "")
value = value.tr("^-0-9", "")
when :uploaded_image_list
value = Upload.get_from_urls(value.split("|")).to_a
end