1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00

Don't crash on unobtainable avatars (#22462)

This commit is contained in:
David Freedman 2023-01-13 15:40:06 +00:00 committed by GitHub
parent 332a411fad
commit ff70e50199
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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