Class: Projects::AvatarsController

Inherits:
ApplicationController show all
Includes:
BlobHelper
Defined in:
app/controllers/projects/avatars_controller.rb

Instance Method Summary collapse

Methods included from BlobHelper

#blob_icon, #blob_size, #blob_text_viewable?, #cached_blob?, #can_edit_blob?, #delete_blob_link, #edit_blob_link, #editing_preview_title, #highlight, #highlighter, #leave_edit_message, #licenses_for_select, #modify_file_link, #no_highlight_files, #replace_blob_link, #safe_content_type, #sanitize_svg

Methods inherited from ApplicationController

#redirect_back_or_default

Methods included from PageLayoutHelper

#blank_container, #container_class, #fluid_layout, #header_title, #nav, #page_card_attributes, #page_card_meta_tags, #page_description, #page_image, #page_title, #sidebar

Methods included from GitlabRoutingHelper

#activity_project_path, #edit_project_path, #edit_project_url, #issue_path, #issue_url, #merge_request_path, #merge_request_url, #milestone_path, #project_builds_path, #project_commits_path, #project_files_path, #project_path, #project_pipelines_path, #project_snippet_url, #project_url, #runner_path, #runners_path, #toggle_subscription_path

Methods included from Gitlab::GonHelper

#add_gon_variables

Methods included from Gitlab::CurrentSettings

#current_application_settings, #fake_application_settings

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Projects::ApplicationController

Instance Method Details

#destroyObject


22
23
24
25
26
27
28
29
# File 'app/controllers/projects/avatars_controller.rb', line 22

def destroy
  @project.remove_avatar!

  @project.save
  @project.reset_events_cache

  redirect_to edit_project_path(@project)
end

#showObject


6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/projects/avatars_controller.rb', line 6

def show
  @blob = @repository.blob_at_branch('master', @project.avatar_in_git)
  if @blob
    headers['X-Content-Type-Options'] = 'nosniff'

    return if cached_blob?

    headers.store(*Gitlab::Workhorse.send_git_blob(@repository, @blob))
    headers['Content-Disposition'] = 'inline'
    headers['Content-Type'] = safe_content_type(@blob)
    head :ok # 'render nothing: true' messes up the Content-Type
  else
    render_404
  end
end