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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
6f012638
Commit
6f012638
authored
Feb 18, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6313 from jvanbaarsen/fix-6207-msi-mimetype
Fixes #6207 Allow raw download of *.msi files
parents
767c39a3
aaad7fd9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
app/controllers/projects/raw_controller.rb
app/controllers/projects/raw_controller.rb
+13
-5
No files found.
app/controllers/projects/raw_controller.rb
View file @
6f012638
...
@@ -11,11 +11,7 @@ class Projects::RawController < Projects::ApplicationController
...
@@ -11,11 +11,7 @@ class Projects::RawController < Projects::ApplicationController
@blob
=
@repository
.
blob_at
(
@commit
.
id
,
@path
)
@blob
=
@repository
.
blob_at
(
@commit
.
id
,
@path
)
if
@blob
if
@blob
type
=
if
@blob
.
mime_type
=~
/html|javascript/
type
=
get_blob_type
'text/plain; charset=utf-8'
else
@blob
.
mime_type
end
headers
[
'X-Content-Type-Options'
]
=
'nosniff'
headers
[
'X-Content-Type-Options'
]
=
'nosniff'
...
@@ -29,5 +25,17 @@ class Projects::RawController < Projects::ApplicationController
...
@@ -29,5 +25,17 @@ class Projects::RawController < Projects::ApplicationController
not_found!
not_found!
end
end
end
end
private
def
get_blob_type
if
@blob
.
mime_type
=~
/html|javascript/
'text/plain; charset=utf-8'
elsif
@blob
.
name
=~
/(?:msi|exe|rar|r0\d|7z|7zip|zip)$/
'application/octet-stream'
else
@blob
.
mime_type
end
end
end
end
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