FIX: Allow avatar downloads to follow redirects

This commit is contained in:
Robin Ward 2019-10-24 14:01:54 -04:00 committed by romanrizzi
parent c38c37bcc3
commit 069d358c80

View File

@ -108,7 +108,7 @@ after_initialize do
def fetch_avatar_url(user)
avatar_url = UrlHelper.absolute(Discourse.base_uri + user.avatar_template.gsub('{size}', '250'))
URI(avatar_url).open('rb', redirect: false).read
URI(avatar_url).open('rb', redirect: true, allow_redirections: :all).read
rescue OpenURI::HTTPError
# Ignore if fetching image returns a non 200 response
end