diff options
author | Robert Speicher <rspeicher@gmail.com> | 2018-11-27 21:04:00 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2018-11-27 21:07:02 +0300 |
commit | df8f0ab52128e173690f624575fef286d1a3cf4c (patch) | |
tree | 68e39eb1ed78ccb264a1f6dbaa93b4af7cd52415 /app/controllers/projects/network_controller.rb | |
parent | 1cd570cf77b79f37f30ef3ccd399c337056aa236 (diff) |
Remove `options` assignment from ExtractsPath
This assignment is only used by the Projects::NetworkController, so
we're needlessly assigning this very generically-named instance variable
on every controller which includes `ExtractsPath`, which is quite a few.
Further, the way we were passing this hash to
`HashWithIndifferentAccess` caused the following deprecation warning
after upgrading to Rails 5:
DEPRECATION WARNING: #to_hash unexpectedly ignores parameter
filtering, and will change to enforce it in Rails 5.1. Enable
`raise_on_unfiltered_parameters` to respect parameter filtering,
which is the default in new applications. For the existing
deprecated behaviour, call #to_unsafe_h instead. (called from new at
lib/extracts_path.rb:116)
Diffstat (limited to 'app/controllers/projects/network_controller.rb')
-rw-r--r-- | app/controllers/projects/network_controller.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/app/controllers/projects/network_controller.rb b/app/controllers/projects/network_controller.rb index ad2466a8588..6543711ecfa 100644 --- a/app/controllers/projects/network_controller.rb +++ b/app/controllers/projects/network_controller.rb @@ -8,6 +8,7 @@ class Projects::NetworkController < Projects::ApplicationController before_action :require_non_empty_project before_action :assign_ref_vars before_action :authorize_download_code! + before_action :assign_options before_action :assign_commit def show @@ -29,10 +30,13 @@ class Projects::NetworkController < Projects::ApplicationController render end + def assign_options + @options = params.permit(:filter_ref, :extended_sha1) + end + def assign_commit - return if params[:extended_sha1].blank? + return if @options[:extended_sha1].blank? - @options[:extended_sha1] = params[:extended_sha1] @commit = @repo.commit(@options[:extended_sha1]) end |