Commit 19ad2a49 authored by Douwe Maan's avatar Douwe Maan

Revert "[Rails5] Set request.format in commits_controller"

This reverts commit 6da19415.

# Conflicts:
#	app/controllers/projects/commits_controller.rb
parent 16f7243f
...@@ -12,7 +12,6 @@ class Projects::CommitsController < Projects::ApplicationController ...@@ -12,7 +12,6 @@ class Projects::CommitsController < Projects::ApplicationController
before_action :assign_ref_vars, except: :commits_root before_action :assign_ref_vars, except: :commits_root
before_action :authorize_download_code! before_action :authorize_download_code!
before_action :set_commits, except: :commits_root before_action :set_commits, except: :commits_root
before_action :set_request_format, only: :show
def commits_root def commits_root
redirect_to project_commits_path(@project, @project.default_branch) redirect_to project_commits_path(@project, @project.default_branch)
...@@ -71,19 +70,6 @@ class Projects::CommitsController < Projects::ApplicationController ...@@ -71,19 +70,6 @@ class Projects::CommitsController < Projects::ApplicationController
@commits = set_commits_for_rendering(@commits) @commits = set_commits_for_rendering(@commits)
end end
# Rails 5 sets request.format from the extension.
# Explicitly set to :html.
def set_request_format
request.format = :html if set_request_format?
end
# Rails 5 sets request.format from extension.
# In this case if the ref ends with `.atom`, it's expected to be the html response,
# not the atom one. So explicitly set request.format as :html to act like rails4.
def set_request_format?
request.format.to_s == "text/html" || @commits.ref.ends_with?("atom")
end
def whitelist_query_limiting def whitelist_query_limiting
Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-ce/issues/42330') Gitlab::QueryLimiting.whitelist('https://gitlab.com/gitlab-org/gitlab-ce/issues/42330')
end end
......
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