1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00

Ensure case-insensitive fields are converted to lowercase in Admin Imports (#29739)

This commit is contained in:
Emelia Smith 2024-03-26 10:30:07 +01:00 committed by GitHub
parent 06fc2b3fde
commit a3e8b78250
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -30,12 +30,14 @@ class Admin::Import
csv_converter = lambda do |field, field_info|
case field_info.header
when '#domain', '#public_comment'
when '#domain'
field&.downcase&.strip
when '#public_comment'
field&.strip
when '#severity'
field&.strip&.to_sym
field&.downcase&.strip&.to_sym
when '#reject_media', '#reject_reports', '#obfuscate'
ActiveModel::Type::Boolean.new.cast(field)
ActiveModel::Type::Boolean.new.cast(field&.downcase)
else
field
end