BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
7bba2a19
Commit
7bba2a19
authored
Apr 14, 2015
by
Hannes Rosenögger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove access control for images
This commit removes the access control for uploaded images. This is needed to display the images in emails again.
parent
ed94cde2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
6 deletions
+25
-6
uploads_controller.rb
app/controllers/projects/uploads_controller.rb
+25
-6
No files found.
app/controllers/projects/uploads_controller.rb
View file @
7bba2a19
class
Projects
::
UploadsController
<
Projects
::
ApplicationController
layout
'project'
before_filter
:project
skip_before_filter
:project
,
:repository
,
:authenticate_user!
,
only:
[
:show
]
before_filter
:authorize_uploads
,
only:
[
:show
]
def
create
link_to_file
=
::
Projects
::
UploadService
.
new
(
project
,
params
[
:file
]).
...
...
@@ -21,15 +23,32 @@ class Projects::UploadsController < Projects::ApplicationController
end
def
show
uploader
=
FileUploader
.
new
(
project
,
params
[
:secret
])
uploader
=
get_file
return
not_found!
if
uploader
.
nil?
||
!
uploader
.
file
.
exists?
disposition
=
uploader
.
image?
?
'inline'
:
'attachment'
send_file
uploader
.
file
.
path
,
disposition:
disposition
end
def
get_file
namespace
=
params
[
:namespace_id
]
id
=
params
[
:project_id
]
return
redirect_to
uploader
.
url
unless
uploader
.
file_storage?
file_project
=
Project
.
find_with_namespace
(
"
#{
namespace
}
/
#{
id
}
"
)
return
nil
if
file_project
.
nil?
uploader
=
FileUploader
.
new
(
file_project
,
params
[
:secret
])
uploader
.
retrieve_from_store!
(
params
[
:filename
])
return
not_found!
unless
uploader
.
file
.
exists?
uploader
end
disposition
=
uploader
.
image?
?
'inline'
:
'attachment'
send_file
uploader
.
file
.
path
,
disposition:
disposition
def
authorize_uploads
uploader
=
get_file
unless
uploader
&&
uploader
.
image?
project
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