diff --git a/app/jobs/regular/pull_hotlinked_images.rb b/app/jobs/regular/pull_hotlinked_images.rb index 1e179af299b..e7142b9ee5a 100644 --- a/app/jobs/regular/pull_hotlinked_images.rb +++ b/app/jobs/regular/pull_hotlinked_images.rb @@ -31,7 +31,10 @@ module Jobs begin # have we already downloaded that file? if !downloaded_urls.include?(src) - hotlinked = FileHelper.download(src, @max_size, "discourse-hotlinked") rescue Discourse::InvalidParameters + begin + hotlinked = FileHelper.download(src, @max_size, "discourse-hotlinked") + rescue Discourse::InvalidParameters + end if hotlinked.try(:size) <= @max_size filename = File.basename(URI.parse(src).path) upload = Upload.create_for(post.user_id, hotlinked, filename, hotlinked.size, { origin: src })