diff --git a/app/jobs/regular/pull_hotlinked_images.rb b/app/jobs/regular/pull_hotlinked_images.rb index 8baf5d35e30..5d215a12093 100644 --- a/app/jobs/regular/pull_hotlinked_images.rb +++ b/app/jobs/regular/pull_hotlinked_images.rb @@ -5,7 +5,6 @@ module Jobs sidekiq_options queue: "low" def initialize - @max_size = SiteSetting.max_image_size_kb.kilobytes end def execute(args) @@ -101,7 +100,7 @@ module Jobs downloaded = FileHelper.download( src, - max_file_size: @max_size, + max_file_size: SiteSetting.max_image_size_kb.kilobytes, retain_on_max_file_size_exceeded: true, tmp_file_name: "discourse-hotlinked", follow_redirect: true, @@ -137,7 +136,9 @@ module Jobs hotlinked = download(src) raise ImageBrokenError if !hotlinked - raise ImageTooLargeError if File.size(hotlinked.path) > @max_size + if File.size(hotlinked.path) > SiteSetting.max_image_size_kb.kilobytes + raise ImageTooLargeError + end filename = File.basename(URI.parse(src).path) filename << File.extname(hotlinked.path) unless filename["."]