Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
e8bbc837
Commit
e8bbc837
authored
9 years ago
by
Stan Hu
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #9598 from darkrasid/master
Add image content-type header in raw download
parents
69beca5a
4144c599
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
0 deletions
+17
-0
CHANGELOG
CHANGELOG
+1
-0
app/controllers/projects/raw_controller.rb
app/controllers/projects/raw_controller.rb
+2
-0
spec/controllers/projects/raw_controller_spec.rb
spec/controllers/projects/raw_controller_spec.rb
+14
-0
No files found.
CHANGELOG
View file @
e8bbc837
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
app/controllers/projects/raw_controller.rb
View file @
e8bbc837
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
spec/controllers/projects/raw_controller_spec.rb
View file @
e8bbc837
...
...
@@ -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
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment