add Content-Type header of raw image file
Add Content-Type header to fix a bug which IE can't show image in markdown when the image is from raw. modified: CHANGELOG modified: app/controllers/projects/raw_controller.rb modified: spec/controllers/projects/raw_controller_spec.rb
This commit is contained in:
parent
996f51559b
commit
4144c59941
3 changed files with 17 additions and 0 deletions
|
@ -36,6 +36,7 @@ v 8.0.0 (unreleased)
|
||||||
- Refactored service API and added automatically service docs generator (Kirill Zaitsev)
|
- Refactored service API and added automatically service docs generator (Kirill Zaitsev)
|
||||||
- Added web_url key project hook_attrs (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
|
- 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
|
v 7.14.1
|
||||||
- Improve abuse reports management from admin area
|
- Improve abuse reports management from admin area
|
||||||
|
|
|
@ -29,6 +29,8 @@ class Projects::RawController < Projects::ApplicationController
|
||||||
def get_blob_type
|
def get_blob_type
|
||||||
if @blob.text?
|
if @blob.text?
|
||||||
'text/plain; charset=utf-8'
|
'text/plain; charset=utf-8'
|
||||||
|
elsif @blob.image?
|
||||||
|
@blob.content_type
|
||||||
else
|
else
|
||||||
'application/octet-stream'
|
'application/octet-stream'
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,5 +19,19 @@ describe Projects::RawController do
|
||||||
to eq("inline")
|
to eq("inline")
|
||||||
end
|
end
|
||||||
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
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue