Fix upload page fetching source for wrong page from twitter
It would always fetch from the referer, regardless of what page that was. It didn't even have to be a page on twitter.
This commit is contained in:
@@ -1,9 +1,17 @@
|
||||
module Sources::Strategies
|
||||
class Twitter < Base
|
||||
def self.url_match?(url)
|
||||
url =~ %r!https?://(?:mobile\.)?twitter\.com/\w+/status/\d+!
|
||||
url =~ %r!https?://(?:mobile\.)?twitter\.com/\w+/status/\d+! || url =~ %r{https?://pbs\.twimg\.com/media/}
|
||||
end
|
||||
|
||||
def referer_url(template)
|
||||
if template.params[:ref] =~ %r!https?://(?:mobile\.)?twitter\.com/\w+/status/\d+! && template.params[:url] =~ %r{https?://pbs\.twimg\.com/media/}
|
||||
template.params[:ref]
|
||||
else
|
||||
template.params[:url]
|
||||
end
|
||||
end
|
||||
|
||||
def tags
|
||||
[]
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user