We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7ec7bc6 commit 4aa23abCopy full SHA for 4aa23ab
lib/transformative/view_helper.rb
@@ -242,8 +242,13 @@ def link_hashtags_twitter(content)
242
243
def force_https_author_profile(photo_url, base_url)
244
url = URI.join(base_url, photo_url).to_s
245
- if url.start_with?('http://pbs.twimg.com')
246
- url.gsub 'http://pbs.twimg.com', 'https://pbs.twimg.com'
+ # use unavatar.now.sh to avoid avatar rot
+ if url.match(/pbs\.twimg\.com/)
247
+ screen_name = base_url.split('/').last
248
+ return "https://unavatar.now.sh/twitter/#{screen_name}"
249
+ elsif url.match(/cdninstagram\.com/)
250
+ screen_name = base_url.split('/')[3]
251
+ return "https://unavatar.now.sh/instagram/#{screen_name}"
252
end
253
https_image(url)
254
0 commit comments