about summary refs log tree commit diff
path: root/app/models
diff options
context:
space:
mode:
authorEugen <eugen@zeonfederated.com>2017-01-19 02:14:57 +0100
committerGitHub <noreply@github.com>2017-01-19 02:14:57 +0100
commit8b9206f7d9565ad8b9026e5cc5e085e28ab0117a (patch)
tree585d08fb28290624d2fd9d40f753870a05f7af03 /app/models
parent306eb6e9c90295dcdff2a0094066542a46a8e634 (diff)
Try to avoid any potential loops
Diffstat (limited to 'app/models')
-rw-r--r--app/models/account.rb10
1 files changed, 3 insertions, 7 deletions
diff --git a/app/models/account.rb b/app/models/account.rb
index 5d6324a7b..621a66e24 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -125,13 +125,9 @@ class Account < ApplicationRecord
 
   def save_with_optional_avatar!
     save!
-  rescue ActiveRecord::RecordInvalid => invalid
-    if invalid.record.errors[:avatar_file_size] || invalid.record.errors[:avatar_content_type]
-      self.avatar = nil
-      retry
-    end
-
-    raise invalid
+  rescue ActiveRecord::RecordInvalid
+    self.avatar = nil
+    save!
   end
 
   def avatar_remote_url=(url)