From c3b89fff70685a5b61c193f98b47d5a4de0e41d6 Mon Sep 17 00:00:00 2001 From: MAEDA Go Date: Sun, 16 Nov 2025 18:00:39 +0900 Subject: [PATCH 2/4] Stop using legacy image/x-ms-bmp MIME type for BMP files --- lib/redmine/mime_type.rb | 1 - test/helpers/application_helper_test.rb | 62 +++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 1 deletion(-) diff --git a/lib/redmine/mime_type.rb b/lib/redmine/mime_type.rb index 5554cc5a9..0584e0308 100644 --- a/lib/redmine/mime_type.rb +++ b/lib/redmine/mime_type.rb @@ -44,7 +44,6 @@ module Redmine 'image/png' => 'png', 'image/tiff' => 'tiff,tif', 'image/webp' => 'webp', - 'image/x-ms-bmp' => 'bmp', 'application/javascript' => 'js', 'application/pdf' => 'pdf', 'video/mp4' => 'mp4', diff --git a/test/helpers/application_helper_test.rb b/test/helpers/application_helper_test.rb index 873f6aa6f..f54b2eb97 100644 --- a/test/helpers/application_helper_test.rb +++ b/test/helpers/application_helper_test.rb @@ -200,6 +200,68 @@ class ApplicationHelperTest < Redmine::HelperTest end end + def test_attached_images_filename_extension + a1 = + Attachment.new( + :container => Issue.find(1), + :file => mock_file_with_options({:original_filename => "testtest.JPG"}), + :author => User.find(1) + ) + assert a1.save + assert_equal "testtest.JPG", a1.filename + assert_equal "image/jpeg", a1.content_type + assert a1.image? + + a2 = + Attachment.new( + :container => Issue.find(1), + :file => mock_file_with_options({:original_filename => "testtest.jpeg"}), + :author => User.find(1) + ) + assert a2.save + assert_equal "testtest.jpeg", a2.filename + assert_equal "image/jpeg", a2.content_type + assert a2.image? + + a3 = + Attachment.new( + :container => Issue.find(1), + :file => mock_file_with_options({:original_filename => "testtest.JPE"}), + :author => User.find(1) + ) + assert a3.save + assert_equal "testtest.JPE", a3.filename + assert_equal "image/jpeg", a3.content_type + assert a3.image? + + a4 = + Attachment.new( + :container => Issue.find(1), + :file => mock_file_with_options({:original_filename => "Testtest.BMP"}), + :author => User.find(1) + ) + assert a4.save + assert_equal "Testtest.BMP", a4.filename + assert_equal "image/bmp", a4.content_type + assert a4.image? + + to_test = { + 'Inline image: !testtest.jpg!' => + 'Inline image: ', + 'Inline image: !testtest.jpeg!' => + 'Inline image: ', + 'Inline image: !testtest.jpe!' => + 'Inline image: ', + 'Inline image: !testtest.bmp!' => + 'Inline image: ', + } + + attachments = [a1, a2, a3, a4] + with_settings :text_formatting => 'textile' do + to_test.each {|text, result| assert_equal "

#{result}

", textilizable(text, :attachments => attachments)} + end + end + def test_textile_external_links to_test = { 'This is a "link":http://foo.bar' => 'This is a link', -- 2.50.1