DEV: Avoid initializing max_image_size_kb in initializer (#28209)
Since this might initialize to the default db's values rather than that of the site.
This commit is contained in:
parent
6ec8728ebf
commit
624dc87321
|
@ -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["."]
|
||||
|
|
Loading…
Reference in New Issue