diff options
author | Connor Shea <connor.james.shea@gmail.com> | 2016-05-16 17:06:26 -0500 |
---|---|---|
committer | Connor Shea <connor.james.shea@gmail.com> | 2016-07-11 12:55:25 -0600 |
commit | 3358afa758c7db96ea8fce2a10cdf9c0abe85216 (patch) | |
tree | 74ab1040e343b43706b677e8c8f5582e640ff483 /app/controllers/help_controller.rb | |
parent | 61f0e89484be5aca5d22ab63c72b08575f7e3f6d (diff) | |
download | gitlab-ce-3358afa758c7db96ea8fce2a10cdf9c0abe85216.tar.gz |
Update the help_page_path route to accept paths directly instead of using parameters.
Diffstat (limited to 'app/controllers/help_controller.rb')
-rw-r--r-- | app/controllers/help_controller.rb | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/app/controllers/help_controller.rb b/app/controllers/help_controller.rb index 9b5c43b17e2..d5dc894e0bd 100644 --- a/app/controllers/help_controller.rb +++ b/app/controllers/help_controller.rb @@ -12,13 +12,12 @@ class HelpController < ApplicationController end def show - @category = clean_path_info(path_params[:category]) - @file = path_params[:file] + @path = path_params[:path] respond_to do |format| format.any(:markdown, :md, :html) do # Note: We are purposefully NOT using `Rails.root.join` - path = File.join(Rails.root, 'doc', @category, "#{@file}.md") + path = File.join(Rails.root, 'doc', "#{@path}.md") if File.exist?(path) @markdown = File.read(path) @@ -33,7 +32,7 @@ class HelpController < ApplicationController # Allow access to images in the doc folder format.any(:png, :gif, :jpeg) do # Note: We are purposefully NOT using `Rails.root.join` - path = File.join(Rails.root, 'doc', @category, "#{@file}.#{params[:format]}") + path = File.join(Rails.root, 'doc', "#{@path}.#{params[:format]}") if File.exist?(path) send_file(path, disposition: 'inline') @@ -57,8 +56,7 @@ class HelpController < ApplicationController private def path_params - params.require(:category) - params.require(:file) + params.require(:path) params end |