Class: Projects::ArtifactsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/projects/artifacts_controller.rb

Instance Method Summary collapse

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

#browseObject


17
18
19
20
21
22
23
24
# File 'app/controllers/projects/artifacts_controller.rb', line 17

def browse
  return render_404 unless build.artifacts?

  directory = params[:path] ? "#{params[:path]}/" : ''
  @entry = build.(directory)

  return render_404 unless @entry.exists?
end

#downloadObject


5
6
7
8
9
10
11
12
13
14
15
# File 'app/controllers/projects/artifacts_controller.rb', line 5

def download
  unless artifacts_file.file_storage?
    return redirect_to artifacts_file.url
  end

  unless artifacts_file.exists?
    return render_404
  end

  send_file artifacts_file.path, disposition: 'attachment'
end

#fileObject


26
27
28
29
30
31
32
33
34
35
# File 'app/controllers/projects/artifacts_controller.rb', line 26

def file
  entry = build.(params[:path])

  if entry.exists?
    render json: { archive: build.artifacts_file.path,
                   entry: Base64.encode64(entry.path) }
  else
    render json: {}, status: 404
  end
end