diff options
author | Marin Jankovski <maxlazio@gmail.com> | 2016-03-14 11:40:17 +0100 |
---|---|---|
committer | Marin Jankovski <maxlazio@gmail.com> | 2016-03-14 11:40:17 +0100 |
commit | 90c10f4dab503aeb24d7ca44e48fc0a607832760 (patch) | |
tree | d36d9f67286928820c401e2f4c7c321e47069480 /app | |
parent | c07ef544d1eac5e6d838e1cd8826dee93ddd365e (diff) | |
parent | 8e7661c218c1d9c6fd856af69cabc77c1cd0d22d (diff) | |
download | gitlab-ce-90c10f4dab503aeb24d7ca44e48fc0a607832760.tar.gz |
Merge branch 'master' of dev.gitlab.org:gitlab/gitlabhq
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/concerns/continue_params.rb | 13 | ||||
-rw-r--r-- | app/controllers/projects/forks_controller.rb | 13 | ||||
-rw-r--r-- | app/controllers/projects/imports_controller.rb | 12 |
3 files changed, 17 insertions, 21 deletions
diff --git a/app/controllers/concerns/continue_params.rb b/app/controllers/concerns/continue_params.rb new file mode 100644 index 00000000000..0a995c45bdf --- /dev/null +++ b/app/controllers/concerns/continue_params.rb @@ -0,0 +1,13 @@ +module ContinueParams + extend ActiveSupport::Concern + + def continue_params + continue_params = params[:continue] + return nil unless continue_params + + continue_params = continue_params.permit(:to, :notice, :notice_now) + return unless continue_params[:to] && continue_params[:to].start_with?('/') + + continue_params + end +end diff --git a/app/controllers/projects/forks_controller.rb b/app/controllers/projects/forks_controller.rb index 7b202f3862f..a1b8632df98 100644 --- a/app/controllers/projects/forks_controller.rb +++ b/app/controllers/projects/forks_controller.rb @@ -1,4 +1,6 @@ class Projects::ForksController < Projects::ApplicationController + include ContinueParams + # Authorize before_action :require_non_empty_project before_action :authorize_download_code! @@ -53,15 +55,4 @@ class Projects::ForksController < Projects::ApplicationController render :error end end - - private - - def continue_params - continue_params = params[:continue] - if continue_params - continue_params.permit(:to, :notice, :notice_now) - else - nil - end - end end diff --git a/app/controllers/projects/imports_controller.rb b/app/controllers/projects/imports_controller.rb index 196996f1752..7756f0f0ed3 100644 --- a/app/controllers/projects/imports_controller.rb +++ b/app/controllers/projects/imports_controller.rb @@ -1,4 +1,6 @@ class Projects::ImportsController < Projects::ApplicationController + include ContinueParams + # Authorize before_action :authorize_admin_project! before_action :require_no_repo, only: [:new, :create] @@ -44,16 +46,6 @@ class Projects::ImportsController < Projects::ApplicationController private - def continue_params - continue_params = params[:continue] - - if continue_params - continue_params.permit(:to, :notice, :notice_now) - else - nil - end - end - def finished_notice if @project.forked? 'The project was successfully forked.' |