2015-04-26 12:48:37 +05:30
|
|
|
class Projects::AvatarsController < Projects::ApplicationController
|
2015-09-11 14:41:01 +05:30
|
|
|
before_action :project
|
2015-04-26 12:48:37 +05:30
|
|
|
|
|
|
|
def show
|
2016-04-02 18:10:28 +05:30
|
|
|
@blob = @repository.blob_at_branch('master', @project.avatar_in_git)
|
2015-04-26 12:48:37 +05:30
|
|
|
if @blob
|
|
|
|
headers['X-Content-Type-Options'] = 'nosniff'
|
2016-04-02 18:10:28 +05:30
|
|
|
headers.store(*Gitlab::Workhorse.send_git_blob(@repository, @blob))
|
|
|
|
headers['Content-Disposition'] = 'inline'
|
|
|
|
headers['Content-Type'] = @blob.content_type
|
|
|
|
head :ok # 'render nothing: true' messes up the Content-Type
|
2015-04-26 12:48:37 +05:30
|
|
|
else
|
2015-10-24 18:46:33 +05:30
|
|
|
render_404
|
2015-04-26 12:48:37 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
|
|
|
@project.remove_avatar!
|
|
|
|
|
|
|
|
@project.save
|
|
|
|
@project.reset_events_cache
|
|
|
|
|
|
|
|
redirect_to edit_project_path(@project)
|
|
|
|
end
|
|
|
|
end
|