gitlab-org--gitlab-foss/app/controllers/concerns/continue_params.rb
Markus Koller 8fd2c08472
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.
2019-06-25 13:19:29 +02:00

16 lines
384 B
Ruby

# frozen_string_literal: true
module ContinueParams
include InternalRedirect
extend ActiveSupport::Concern
def continue_params
continue_params = params[:continue]
return {} unless continue_params
continue_params = continue_params.permit(:to, :notice, :notice_now)
continue_params[:to] = safe_redirect_path(continue_params[:to])
continue_params
end
end