gitlab-org--gitlab-foss/app/controllers/projects/avatars_controller.rb

28 lines
559 B
Ruby
Raw Normal View History

class Projects::AvatarsController < Projects::ApplicationController
include BlobHelper
2016-03-20 16:03:53 -04:00
before_action :authorize_admin_project!, only: [:destroy]
def show
2016-02-02 09:06:14 -05:00
@blob = @repository.blob_at_branch('master', @project.avatar_in_git)
if @blob
headers['X-Content-Type-Options'] = 'nosniff'
2016-03-07 08:27:53 -05:00
return if cached_blob?
send_git_blob @repository, @blob
else
2015-10-09 13:07:29 -04:00
render_404
end
end
def destroy
@project.remove_avatar!
@project.save
@project.reset_events_cache
redirect_to edit_project_path(@project)
end
end