mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 10:55:25 +08:00
FIX: Upload.migrate_to_new_scheme
undefined error when external image fails to download.
This commit is contained in:
parent
b5e32cfe2a
commit
d0a1922ad9
|
@ -239,12 +239,21 @@ class Upload < ActiveRecord::Base
|
||||||
# download if external
|
# download if external
|
||||||
if external
|
if external
|
||||||
url = SiteSetting.scheme + ":" + previous_url
|
url = SiteSetting.scheme + ":" + previous_url
|
||||||
file = FileHelper.download(
|
|
||||||
url,
|
begin
|
||||||
max_file_size: max_file_size_kb,
|
retries ||= 0
|
||||||
tmp_file_name: "discourse",
|
|
||||||
follow_redirect: true
|
file = FileHelper.download(
|
||||||
) rescue nil
|
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
|
path = file.path
|
||||||
else
|
else
|
||||||
path = local_store.path_for(upload)
|
path = local_store.path_for(upload)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user