A platform for community discussion. Free, open, simple.
DEV: Avoid initializing max_image_size_kb in initializer (#28209)
Natalie Tay624dc87321c9
diff --git a/app/jobs/regular/pull_hotlinked_images.rb b/app/jobs/regular/pull_hotlinked_images.rbindex 8baf5d35e30..5d215a12093 100644--- a/app/jobs/regular/pull_hotlinked_images.rb+++ b/app/jobs/regular/pull_hotlinked_images.rb@@ -5,7 +5,6 @@ module Jobssidekiq_options queue: "low"def initialize- @max_size = SiteSetting.max_image_size_kb.kilobytesenddef execute(args)@@ -101,7 +100,7 @@ module Jobsdownloaded =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 Jobshotlinked = 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+ endfilename = File.basename(URI.parse(src).path)filename << File.extname(hotlinked.path) unless filename["."]