about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorDavid Freedman <lcreg-github@convergence.cx>2023-01-13 15:40:06 +0000
committerGitHub <noreply@github.com>2023-01-13 16:40:06 +0100
commitff70e5019910c309f8ab38d729c4eb5819512698 (patch)
tree725465d0071e80100a10cca33b4efd995beafd75 /app
parent332a411fadf961f52706db1e358d92d92ed8bf49 (diff)
Don't crash on unobtainable avatars (#22462)
Diffstat (limited to 'app')
-rw-r--r--app/models/concerns/omniauthable.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/app/models/concerns/omniauthable.rb b/app/models/concerns/omniauthable.rb
index a90d5d888..feac0a1f5 100644
--- a/app/models/concerns/omniauthable.rb
+++ b/app/models/concerns/omniauthable.rb
@@ -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