mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 09:36:19 -05:00
FIX: error message used wrong filesize
This commit is contained in:
parent
c9d72e8845
commit
9a76ee8f8a
1 changed files with 3 additions and 2 deletions
|
@ -78,9 +78,10 @@ class Validators::UploadValidator < ActiveModel::Validator
|
|||
end
|
||||
|
||||
def maximum_file_size(upload, type)
|
||||
max_size_kb = SiteSetting.send("max_#{type}_size_kb").kilobytes
|
||||
max_size_kb = SiteSetting.send("max_#{type}_size_kb")
|
||||
max_size_bytes = max_size_kb.kilobytes
|
||||
|
||||
if upload.filesize > max_size_kb
|
||||
if upload.filesize > max_size_bytes
|
||||
message = I18n.t("upload.#{type}s.too_large", max_size_kb: max_size_kb)
|
||||
upload.errors.add(:filesize, message)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue