FIX: Change max_image_megapixels logic (#25625)

This commit changes `max_image_megapixels` to be used
as is without multiplying by 2 to give extra leway.
We found in reality this was just causing confusion
for admins, especially with the already permissive
40MP default.
This commit is contained in:
Martin Brennan
2024-02-12 09:56:43 +10:00
committed by GitHub
parent fb83058e9d
commit cf4d92f686
3 changed files with 6 additions and 4 deletions

View File

@ -301,12 +301,12 @@ class UploadCreator
@upload.errors.add(:base, I18n.t("upload.empty"))
elsif pixels == 0 && @image_info.type.to_s != "svg"
@upload.errors.add(:base, I18n.t("upload.images.size_not_found"))
elsif max_image_pixels > 0 && pixels >= max_image_pixels * 2
elsif max_image_pixels > 0 && pixels >= max_image_pixels
@upload.errors.add(
:base,
I18n.t(
"upload.images.larger_than_x_megapixels",
max_image_megapixels: SiteSetting.max_image_megapixels * 2,
max_image_megapixels: SiteSetting.max_image_megapixels,
),
)
end