FIX: `Upload.migrate_to_new_scheme` undefined error when external image fails to download.

FIX: Upload.migrate_to_new_scheme undefined error when external image fails to download.

diff --git a/app/models/upload.rb b/app/models/upload.rb
index fd3f3c8..9de4e28 100644
--- a/app/models/upload.rb
+++ b/app/models/upload.rb
@@ -239,12 +239,21 @@ class Upload < ActiveRecord::Base
           # download if external
           if external
             url = SiteSetting.scheme + ":" + previous_url
-            file = FileHelper.download(
-              url,
-              max_file_size: max_file_size_kb,
-              tmp_file_name: "discourse",
-              follow_redirect: true
-            ) rescue nil
+
+            begin
+              retries ||= 0
+
+              file = FileHelper.download(
+                url,
+                max_file_size: max_file_size_kb,
+                tmp_file_name: "discourse",
+                follow_redirect: true
+              )
+            rescue OpenURI::HTTPError
+              retry if (retires += 1) < 1
+              next
+            end
+
             path = file.path
           else
             path = local_store.path_for(upload)

GitHub sha: d0a1922a