Commit 5bf89395 authored by Douwe Maan's avatar Douwe Maan

Merge branch 'rs-to_h-deprecation' into 'master'

Remove `options` assignment from ExtractsPath

See merge request gitlab-org/gitlab-ce!23389
parents 385e8f71 3eadb623
...@@ -8,6 +8,7 @@ class Projects::NetworkController < Projects::ApplicationController ...@@ -8,6 +8,7 @@ class Projects::NetworkController < Projects::ApplicationController
before_action :require_non_empty_project before_action :require_non_empty_project
before_action :assign_ref_vars before_action :assign_ref_vars
before_action :authorize_download_code! before_action :authorize_download_code!
before_action :assign_options
before_action :assign_commit before_action :assign_commit
def show def show
...@@ -29,10 +30,13 @@ class Projects::NetworkController < Projects::ApplicationController ...@@ -29,10 +30,13 @@ class Projects::NetworkController < Projects::ApplicationController
render render
end end
def assign_options
@options = params.permit(:filter_ref, :extended_sha1)
end
def assign_commit 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]) @commit = @repo.commit(@options[:extended_sha1])
end end
......
- page_title "Find File", @ref - page_title "Find File", @ref
.file-finder-holder.tree-holder.clearfix.js-file-finder{ 'data-file-find-url': "#{escape_javascript(project_files_path(@project, @ref, @options.merge(format: :json)))}", 'data-find-tree-url': escape_javascript(project_tree_path(@project, @ref)), 'data-blob-url-template': escape_javascript(project_blob_path(@project, @id || @commit.id)) } .file-finder-holder.tree-holder.clearfix.js-file-finder{ 'data-file-find-url': "#{escape_javascript(project_files_path(@project, @ref, format: :json))}", 'data-find-tree-url': escape_javascript(project_tree_path(@project, @ref)), 'data-blob-url-template': escape_javascript(project_blob_path(@project, @id || @commit.id)) }
.nav-block .nav-block
.tree-ref-holder .tree-ref-holder
= render 'shared/ref_switcher', destination: 'find_file', path: @path = render 'shared/ref_switcher', destination: 'find_file', path: @path
......
...@@ -110,11 +110,6 @@ module ExtractsPath ...@@ -110,11 +110,6 @@ module ExtractsPath
# resolved (e.g., when a user inserts an invalid path or ref). # resolved (e.g., when a user inserts an invalid path or ref).
# rubocop:disable Gitlab/ModuleWithInstanceVariables # rubocop:disable Gitlab/ModuleWithInstanceVariables
def assign_ref_vars def assign_ref_vars
# assign allowed options
allowed_options = ["filter_ref"]
@options = params.select {|key, value| allowed_options.include?(key) && !value.blank? }
@options = HashWithIndifferentAccess.new(@options)
@id = get_id @id = get_id
@ref, @path = extract_ref(@id) @ref, @path = extract_ref(@id)
@repo = @project.repository @repo = @project.repository
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment