diff options
author | Douwe Maan <douwe@selenight.nl> | 2018-11-30 14:53:28 +0300 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2018-12-03 14:29:01 +0300 |
commit | 76bc2f087406ae55f74eaf6c802d52fae4b87ccf (patch) | |
tree | 5043c64f261f6684ac8c70d3213c3166a8236ccd /app/controllers | |
parent | 8403eee8a5324ff0e4ff1ab8e12ac5184b01ebe3 (diff) |
Revert "[Rails5] Explicitly set request.format for blob_controller"
This reverts commit 037334d2f29fbb14d5e366a7b892a75631eb9ace.
# Conflicts:
# app/controllers/projects/blob_controller.rb
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/projects/blob_controller.rb | 13 |
1 files changed, 0 insertions, 13 deletions
diff --git a/app/controllers/projects/blob_controller.rb b/app/controllers/projects/blob_controller.rb index 873c96a5523..60fabd15333 100644 --- a/app/controllers/projects/blob_controller.rb +++ b/app/controllers/projects/blob_controller.rb @@ -9,7 +9,6 @@ class Projects::BlobController < Projects::ApplicationController include ActionView::Helpers::SanitizeHelper prepend_before_action :authenticate_user!, only: [:edit] - before_action :set_request_format, only: [:edit, :show, :update, :destroy] before_action :require_non_empty_project, except: [:new, :create] before_action :authorize_download_code! @@ -242,18 +241,6 @@ class Projects::BlobController < Projects::ApplicationController .last_for_path(@repository, @ref, @path).sha end - # In Rails 4.2 if params[:format] is empty, Rails set it to :html - # But since Rails 5.0 the framework now looks for an extension. - # E.g. for `blob/master/CHANGELOG.md` in Rails 4 the format would be `:html`, but in Rails 5 on it'd be `:md` - # This before_action explicitly sets the `:html` format for all requests unless `:format` is set by a client e.g. by JS for XHR requests. - def set_request_format - request.format = :html if set_request_format? - end - - def set_request_format? - params[:id].present? && params[:format].blank? && request.format != "json" - end - def show_html environment_params = @repository.branch_exists?(@ref) ? { ref: @ref } : { commit: @commit } @environment = EnvironmentsFinder.new(@project, current_user, environment_params).execute.last |