diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-04 15:07:52 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-04 15:07:52 +0300 |
commit | c6c7437861bff9572747674095c4dfbdfbea4988 (patch) | |
tree | 237d1ed922193f19ae326923457344c082003788 /app/controllers/projects/releases_controller.rb | |
parent | d80f3cd75e700b6e62910865bfd36734644ffa89 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/controllers/projects/releases_controller.rb')
-rw-r--r-- | app/controllers/projects/releases_controller.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/app/controllers/projects/releases_controller.rb b/app/controllers/projects/releases_controller.rb index 7ad841d645d..d5f93c4baf6 100644 --- a/app/controllers/projects/releases_controller.rb +++ b/app/controllers/projects/releases_controller.rb @@ -3,7 +3,7 @@ class Projects::ReleasesController < Projects::ApplicationController # Authorize before_action :require_non_empty_project, except: [:index] - before_action :release, only: %i[edit show update] + before_action :release, only: %i[edit show update downloads] before_action :authorize_read_release! before_action do push_frontend_feature_flag(:release_issue_summary, project) @@ -40,6 +40,10 @@ class Projects::ReleasesController < Projects::ApplicationController end end + def downloads + redirect_to link.url + end + protected def releases @@ -69,6 +73,14 @@ class Projects::ReleasesController < Projects::ApplicationController @release ||= project.releases.find_by_tag!(sanitized_tag_name) end + def link + release.links.find_by_filepath!(sanitized_filepath) + end + + def sanitized_filepath + CGI.unescape(params[:filepath]) + end + def sanitized_tag_name CGI.unescape(params[:tag]) end |