bundle update mini_magick

Change-Id: Idbb17be695cc509f511838183fc478fe01116fb4
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/352301
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Build-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
Cody Cutrer 2024-07-09 13:39:33 -06:00
parent 6e270e9ad3
commit 8da90ee5a4
5 changed files with 19 additions and 11 deletions

View File

@ -80,7 +80,7 @@ gem "link_header", "0.0.8"
gem "marginalia", "1.11.1", require: false
gem "method_source", "~> 1.1"
gem "mime-types", "~> 3.5"
gem "mini_magick", "~> 4.12"
gem "mini_magick", "~> 5.0"
gem "multi_json", "1.15.0"
gem "net-http", "~> 0.1", require: false
gem "net-ldap", "~> 0.18", require: false

View File

@ -743,7 +743,7 @@ GEM
mime-types (3.5.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2024.0903)
mini_magick (4.13.1)
mini_magick (5.0.1)
mini_mime (1.1.5)
mini_portile2 (2.8.7)
minitest (5.25.1)
@ -1327,7 +1327,7 @@ DEPENDENCIES
matrix (= 0.4.2)
method_source (~> 1.1)
mime-types (~> 3.5)
mini_magick (~> 4.12)
mini_magick (~> 5.0)
moodle_importer!
multi_json (= 1.15.0)
net-http (~> 0.1)

View File

@ -56,6 +56,8 @@ module AttachmentFu # :nodoc:
@resized = true
end
end
rescue MiniMagick::Error => e
logger.warn("MiniMagick processing failed: #{e}")
end
# Performs the actual resizing operation for a thumbnail

View File

@ -81,6 +81,7 @@ module Factories
end
def stub_png_data(filename = "test my file? hai!&.png", data = nil)
data ||= file_fixture("instructure.png").read
stub_file_data(filename, data, "image/png")
end

View File

@ -2452,16 +2452,21 @@ describe Attachment do
end
context "quota" do
def stub_text_data
$stub_file_counter ||= 0
stub_file_data("file.txt", "some data#{$stub_file_counter += 1}", "text/plain")
end
it "gives small files a minimum quota size" do
course_model
attachment_model(context: @course, uploaded_data: stub_png_data, size: 25)
attachment_model(context: @course, uploaded_data: stub_text_data, size: 25)
quota = Attachment.get_quota(@course)
expect(quota[:quota_used]).to eq Attachment::MINIMUM_SIZE_FOR_QUOTA
end
it "does not count attachments a student has used for submissions towards the quota" do
course_with_student(active_all: true)
attachment_model(context: @user, uploaded_data: stub_png_data, filename: "homework.png")
attachment_model(context: @user, uploaded_data: stub_text_data, filename: "homework.txt")
@attachment.update_attribute(:size, 1.megabyte)
quota = Attachment.get_quota(@user)
@ -2470,7 +2475,7 @@ describe Attachment do
@assignment = @course.assignments.create!
@assignment.submit_homework(@user, attachments: [@attachment])
attachment_model(context: @user, uploaded_data: stub_png_data, filename: "otherfile.png")
attachment_model(context: @user, uploaded_data: stub_text_data, filename: "otherfile.txt")
@attachment.update_attribute(:size, 1.megabyte)
quota = Attachment.get_quota(@user)
@ -2479,7 +2484,7 @@ describe Attachment do
it "does not count attachments a student has used for graded discussion replies towards the quota" do
course_with_student(active_all: true)
attachment_model(context: @user, uploaded_data: stub_png_data, filename: "homework.png")
attachment_model(context: @user, uploaded_data: stub_text_data, filename: "homework.txt")
@attachment.update_attribute(:size, 1.megabyte)
quota = Attachment.get_quota(@user)
@ -2491,7 +2496,7 @@ describe Attachment do
entry.attachment = @attachment
entry.save!
attachment_model(context: @user, uploaded_data: stub_png_data, filename: "otherfile.png")
attachment_model(context: @user, uploaded_data: stub_text_data, filename: "otherfile.txt")
@attachment.update_attribute(:size, 1.megabyte)
quota = Attachment.get_quota(@user)
@ -2500,7 +2505,7 @@ describe Attachment do
it "does not count attachments in submissions folders toward the quota" do
user_model
attachment_model(context: @user, uploaded_data: stub_png_data, filename: "whatever.png", folder: @user.submissions_folder)
attachment_model(context: @user, uploaded_data: stub_text_data, filename: "whatever.txt", folder: @user.submissions_folder)
@attachment.update_attribute(:size, 1.megabyte)
quota = Attachment.get_quota(@user)
expect(quota[:quota_used]).to eq 0
@ -2508,7 +2513,7 @@ describe Attachment do
it "does not count attachments in group submissions folders toward the quota" do
group_model
attachment_model(context: @group, uploaded_data: stub_png_data, filename: "whatever.png", folder: @group.submissions_folder)
attachment_model(context: @group, uploaded_data: stub_text_data, filename: "whatever.txt", folder: @group.submissions_folder)
@attachment.update_attribute(:size, 1.megabyte)
quota = Attachment.get_quota(@group)
expect(quota[:quota_used]).to eq 0
@ -2517,7 +2522,7 @@ describe Attachment do
it "returns available quota" do
course_model
@course.update storage_quota: 5.megabytes
attachment_model(context: @course, uploaded_data: stub_png_data, filename: "whatever.png")
attachment_model(context: @course, uploaded_data: stub_text_data, filename: "whatever.txt")
@attachment.update_attribute :size, 1.megabyte
expect(Attachment.quota_available(@course)).to eq 4.megabytes