Index: test/functional/attachments_controller_test.rb =================================================================== --- test/functional/attachments_controller_test.rb (revision 2792) +++ test/functional/attachments_controller_test.rb (working copy) @@ -63,6 +63,15 @@ assert_equal 'text/html', @response.content_type end + # check that image/x-png will be sent as image/png, see AttachmentsController.download + # - Sijmen Mulder , Jun 24, 2009 + def test_png_content_type + get :show, :id => 11 + assert_response :success + assert_template 'file' + assert_equal 'image/png', @response.content_type + end + def test_show_text_file_should_send_if_too_big Setting.file_max_size_displayed = 512 Attachment.find(4).update_attribute :filesize, 754.kilobyte Index: test/fixtures/attachments.yml =================================================================== --- test/fixtures/attachments.yml (revision 2792) +++ test/fixtures/attachments.yml (working copy) @@ -121,4 +121,16 @@ filename: picture.jpg author_id: 2 content_type: image/jpeg - \ No newline at end of file +attachments_011: + created_on: 2006-07-19 21:07:27 +02:00 + container_type: Issue + container_id: 2 + downloads: 0 + disk_filename: testfile.txt + digest: b91e08d0cf966d5c6ff411bd8c4cc3a2 + id: 11 + filesize: 452 + filename: testfile.png + author_id: 2 + content_type: image/x-png + Index: app/controllers/attachments_controller.rb =================================================================== --- app/controllers/attachments_controller.rb (revision 2792) +++ app/controllers/attachments_controller.rb (working copy) @@ -39,6 +39,12 @@ @attachment.increment_download end + # correct content type for PNG is image/png, but IE uploads as image/x-png. would be no big + # deal if not for Chrome not interpreting image/x-png as PNG image. + # - Sijmen Mulder , Jun 24, 2009 + content_type = @attachment.content_type + content_type = "image/png" if content_type == "image/x-png" + # images are sent inline send_file @attachment.diskfile, :filename => filename_for_content_disposition(@attachment.filename), :type => @attachment.content_type,