debian-mirror-gitlab/app/controllers/projects/avatars_controller.rb

27 lines
539 B
Ruby
Raw Normal View History

2015-04-26 12:48:37 +05:30
class Projects::AvatarsController < Projects::ApplicationController
2016-06-02 11:05:42 +05:30
include BlobHelper
before_action :authorize_admin_project!, only: [:destroy]
2015-04-26 12:48:37 +05:30
def show
2016-09-29 09:46:39 +05:30
@blob = @repository.blob_at_branch(@repository.root_ref, @project.avatar_in_git)
2015-04-26 12:48:37 +05:30
if @blob
headers['X-Content-Type-Options'] = 'nosniff'
2016-06-02 11:05:42 +05:30
return if cached_blob?
send_git_blob @repository, @blob
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
redirect_to edit_project_path(@project)
end
end