diff --git a/CHANGELOG b/CHANGELOG index 7a773a7ed1d49a1554bf8b19d29230901a401594..8154d4333d9f007721e42098414d24b7eafefd81 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -36,6 +36,7 @@ v 8.0.0 (unreleased) - Refactored service API and added automatically service docs generator (Kirill Zaitsev) - Added web_url key project hook_attrs (Kirill Zaitsev) - Add ability to get user information by ID of an SSH key via the API + - Fix bug which IE cannot show image at markdown when the image is raw file of gitlab v 7.14.1 - Improve abuse reports management from admin area diff --git a/app/controllers/projects/raw_controller.rb b/app/controllers/projects/raw_controller.rb index 1a3df40dc755a285b2a1dde1c7df530eba666266..5f6fbce795e950d3792d80be348e1ff724779813 100644 --- a/app/controllers/projects/raw_controller.rb +++ b/app/controllers/projects/raw_controller.rb @@ -29,6 +29,8 @@ class Projects::RawController < Projects::ApplicationController def get_blob_type if @blob.text? 'text/plain; charset=utf-8' + elsif @blob.image? + @blob.content_type else 'application/octet-stream' end diff --git a/spec/controllers/projects/raw_controller_spec.rb b/spec/controllers/projects/raw_controller_spec.rb index 1f921d5f05d0b8fd53897a9ebd503a293bdf662d..c114f3420212fa740896077efc08fe9be501b3ec 100644 --- a/spec/controllers/projects/raw_controller_spec.rb +++ b/spec/controllers/projects/raw_controller_spec.rb @@ -19,5 +19,19 @@ describe Projects::RawController do to eq("inline") end end + + context 'image header' do + let(:id) { 'master/files/images/6049019_460s.jpg' } + + it 'set image content type header' do + get(:show, + namespace_id: public_project.namespace.to_param, + project_id: public_project.to_param, + id: id) + + expect(response.status).to eq(200) + expect(response.header['Content-Type']).to eq('image/jpeg') + end + end end end