logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe
commit: 43d754eb42e119f4852170988e04a4cb9c4ecb64
parent: 2cc0d56652906e5c021aafe66dd50d5983399c37
Author: Eugen Rochko <eugen@zeonfederated.com>
Date:   Fri, 12 May 2017 16:47:55 +0200

Fix not rejecting remote URIs when parsing out local IDs (#3012)


Diffstat:

Mapp/lib/tag_manager.rb1+
Mapp/services/process_interaction_service.rb4+++-
2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/app/lib/tag_manager.rb b/app/lib/tag_manager.rb @@ -48,6 +48,7 @@ class TagManager end def unique_tag_to_local_id(tag, expected_type) + return nil unless local_id?(tag) matches = Regexp.new("objectId=([\\d]+):objectType=#{expected_type}").match(tag) return matches[1] unless matches.nil? end diff --git a/app/services/process_interaction_service.rb b/app/services/process_interaction_service.rb @@ -123,7 +123,9 @@ class ProcessInteractionService < BaseService end def status(xml) - Status.find(TagManager.instance.unique_tag_to_local_id(activity_id(xml), 'Status')) + uri = activity_id(xml) + return nil unless TagManager.instance.local_id?(uri) + Status.find(TagManager.instance.unique_tag_to_local_id(uri, 'Status')) end def activity_id(xml)