Skip to content
Snippets Groups Projects
Unverified Commit ff70e501 authored by David Freedman's avatar David Freedman Committed by GitHub
Browse files

Don't crash on unobtainable avatars (#22462)

parent 332a411f
No related branches found
No related tags found
No related merge requests found
......@@ -55,7 +55,14 @@ module Omniauthable
user = User.new(user_params_from_auth(email, auth))
user.account.avatar_remote_url = auth.info.image if /\A#{URI::DEFAULT_PARSER.make_regexp(%w(http https))}\z/.match?(auth.info.image)
begin
if /\A#{URI::DEFAULT_PARSER.make_regexp(%w(http https))}\z/.match?(auth.info.image)
user.account.avatar_remote_url = auth.info.image
end
rescue Mastodon::UnexpectedResponseError
user.account.avatar_remote_url = nil
end
user.skip_confirmation! if email_is_verified
user.save!
user
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment