diff options
author | Markus Koller <mkoller@gitlab.com> | 2019-06-20 19:13:02 +0200 |
---|---|---|
committer | Markus Koller <mkoller@gitlab.com> | 2019-06-25 13:19:29 +0200 |
commit | 8fd2c08472afc3846ba28f97994a57143bc76eaf (patch) | |
tree | a79905ff65bce863a0b156d450d967a6dae82a72 /app/controllers/projects/imports_controller.rb | |
parent | e8aff8351e7de96c51cdc5c2f1af41fc85c7b57f (diff) | |
download | gitlab-ce-8fd2c08472afc3846ba28f97994a57143bc76eaf.tar.gz |
Make checks for continue_params more robust
The check for continue_params&.key?(:to) in Projects::ImportsController
caused an exception in redirect_to if this key contained a nil value.
Since url_for won't add any params for an empty hash, we can just return
that in continue_params if params[:continue] isn't present, and simplify
the code in the controllers to check for the values we actually want to
use.
Diffstat (limited to 'app/controllers/projects/imports_controller.rb')
-rw-r--r-- | app/controllers/projects/imports_controller.rb | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/app/controllers/projects/imports_controller.rb b/app/controllers/projects/imports_controller.rb index afbf9fd7720..da32ab9e2e0 100644 --- a/app/controllers/projects/imports_controller.rb +++ b/app/controllers/projects/imports_controller.rb @@ -23,7 +23,7 @@ class Projects::ImportsController < Projects::ApplicationController def show if @project.import_finished? - if continue_params&.key?(:to) + if continue_params[:to] redirect_to continue_params[:to], notice: continue_params[:notice] else redirect_to project_path(@project), notice: finished_notice @@ -31,11 +31,7 @@ class Projects::ImportsController < Projects::ApplicationController elsif @project.import_failed? redirect_to new_project_import_path(@project) else - if continue_params && continue_params[:notice_now] - flash.now[:notice] = continue_params[:notice_now] - end - - # Render + flash.now[:notice] = continue_params[:notice_now] end end |