Skip to content
Extraits de code Groupes Projets
Valider 4f852448 rédigé par Claire's avatar Claire Validation de Eugen Rochko
Parcourir les fichiers

Fix crash when encountering invalid account fields (#16598)

* Add test

* Fix crash when encountering invalid account fields
parent c02d6c46
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -295,7 +295,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
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter