mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-09 17:15:18 +00:00
Fix crash when encountering invalid account fields (#16598)
* Add test * Fix crash when encountering invalid account fields
This commit is contained in:
parent
168272fe61
commit
80ca4fdb3c
|
@ -302,7 +302,11 @@ class Account < ApplicationRecord
|
|||
end
|
||||
|
||||
def fields
|
||||
(self[:fields] || []).map { |f| Field.new(self, f) }
|
||||
(self[:fields] || []).map do |f|
|
||||
Field.new(self, f)
|
||||
rescue
|
||||
nil
|
||||
end.compact
|
||||
end
|
||||
|
||||
def fields_attributes=(attributes)
|
||||
|
|
|
@ -12,6 +12,7 @@ RSpec.describe ActivityPub::ProcessAccountService, type: :service do
|
|||
attachment: [
|
||||
{ type: 'PropertyValue', name: 'Pronouns', value: 'They/them' },
|
||||
{ type: 'PropertyValue', name: 'Occupation', value: 'Unit test' },
|
||||
{ type: 'PropertyValue', name: 'non-string', value: ['foo', 'bar'] },
|
||||
],
|
||||
}.with_indifferent_access
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue