Skip to content
Extraits de code Groupes Projets
Valider 6273c295 rédigé par Dennis Schubert's avatar Dennis Schubert Validation de Jonne Haß
Parcourir les fichiers

Rescue from private objects sent to the public api

closes #5938
parent 915dee3c
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -6,6 +6,7 @@
* Dropped db/seeds.rb [#5896](https://github.com/diaspora/diaspora/pull/5896)
* Drop broken install scripts [#5907](https://github.com/diaspora/diaspora/pull/5907)
* Improve invoking mobile site in the testsuite [#5915](https://github.com/diaspora/diaspora/pull/5915)
* Do not retry a couple of unrecoverable job failures [#5938](https://github.com/diaspora/diaspora/pull/5938)
## Bug fixes
* Disable auto follow back on aspect deletion [#5846](https://github.com/diaspora/diaspora/pull/5846)
......
......@@ -14,7 +14,10 @@ module Workers
rescue Diaspora::ContactRequiredUnlessRequest,
Diaspora::RelayableObjectWithoutParent,
# Friendica seems to provoke these
Diaspora::AuthorXMLAuthorMismatch => e
Diaspora::AuthorXMLAuthorMismatch,
# We received a private object to our public endpoint, again something
# Friendica seems to provoke
Diaspora::NonPublic => e
Rails.logger.info("error on receive: #{e.class}")
rescue ActiveRecord::RecordInvalid => e
Rails.logger.info("failed to save received object: #{e.record.errors.full_messages}")
......
......@@ -56,7 +56,7 @@ class Postzord::Receiver::Public < Postzord::Receiver
# @return [Object]
def save_object
@object = Diaspora::Parser::from_xml(@salmon.parsed_data)
raise "Object is not public" if object_can_be_public_and_it_is_not?
raise Diaspora::NonPublic if object_can_be_public_and_it_is_not?
raise Diaspora::RelayableObjectWithoutParent if object_must_have_parent_and_does_not?
raise Diaspora::AuthorXMLAuthorMismatch if author_does_not_match_xml_author?
@object.save! if @object && @object.respond_to?(:save!)
......
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