blob: 0cd65ad5b162c8b454390111676781f55c8c2b8b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
class Projects::AvatarsController < Projects::ApplicationController
before_action :project
def show
repository = @project.repository
@blob = repository.blob_at_branch('master', @project.avatar_in_git)
if @blob
headers['X-Content-Type-Options'] = 'nosniff'
headers['Gitlab-Workhorse-Repo-Path'] = repository.path_to_repo
headers['Gitlab-Workhorse-Send-Blob'] = @blob.id
headers['Content-Disposition'] = 'inline'
render nothing: true, content_type: @blob.content_type
else
render_404
end
end
def destroy
@project.remove_avatar!
@project.save
@project.reset_events_cache
redirect_to edit_project_path(@project)
end
end
|