SECURITY: return error on oversized images
This commit is contained in:
parent
0a4a273ccc
commit
333ddd4011
|
@ -168,6 +168,8 @@ class UploadCreator
|
|||
@upload.errors.add(:base, I18n.t("upload.empty"))
|
||||
elsif pixels == 0
|
||||
@upload.errors.add(:base, I18n.t("upload.images.size_not_found"))
|
||||
elsif max_image_pixels > 0 && pixels >= max_image_pixels * 2
|
||||
@upload.errors.add(:base, I18n.t("upload.images.larger_than_x_megapixels", max_image_megapixels: SiteSetting.max_image_megapixels * 2))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 544 KiB After Width: | Height: | Size: 456 KiB |
|
@ -56,11 +56,11 @@ describe Upload do
|
|||
|
||||
upload = Upload.find(upload.id)
|
||||
|
||||
expect(upload.width).to eq(64250)
|
||||
expect(upload.height).to eq(64250)
|
||||
expect(upload.width).to eq(8900)
|
||||
expect(upload.height).to eq(8900)
|
||||
|
||||
upload.reload
|
||||
expect(upload.read_attribute(:width)).to eq(64250)
|
||||
expect(upload.read_attribute(:width)).to eq(8900)
|
||||
|
||||
upload.update_columns(width: nil, height: nil, thumbnail_width: nil, thumbnail_height: nil)
|
||||
|
||||
|
|
Loading…
Reference in New Issue