gearheads
/
mastodon
Archived
2
0
Fork 0

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

gh/stable
Eugen Rochko 2017-05-12 16:47:55 +02:00 committed by GitHub
parent 2cc0d56652
commit 43d754eb42
2 changed files with 4 additions and 1 deletions

View File

@ -48,6 +48,7 @@ class TagManager
end end
def unique_tag_to_local_id(tag, expected_type) 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) matches = Regexp.new("objectId=([\\d]+):objectType=#{expected_type}").match(tag)
return matches[1] unless matches.nil? return matches[1] unless matches.nil?
end end

View File

@ -123,7 +123,9 @@ class ProcessInteractionService < BaseService
end end
def status(xml) 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 end
def activity_id(xml) def activity_id(xml)